Extension and action examples
Use the action functions with records and Data objects supplied by your application. They pass each argument to the package operation and return its result.
These adapters show container registration. Use the owning package registry when a contract requires contributor discovery.
Contract adapters wrap an existing implementation. Call their registration function from your service provider with that implementation; tagged contracts keep their declared tag. Resolve the backend by its concrete class before registration so the replacement contract does not resolve itself. Static contract metadata uses one backend class per adapter.
Contract Capell\AutomationStudio\Contracts\AutomationActionHandler
Section titled “Contract Capell\AutomationStudio\Contracts\AutomationActionHandler”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
final class AutomationActionHandlerAdapter implements \Capell\AutomationStudio\Contracts\AutomationActionHandler{ public function __construct(private readonly \Capell\AutomationStudio\Contracts\AutomationActionHandler $backend) {}
#[\Override] public function handle(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, \Capell\AutomationStudio\Data\AutomationRuleActionData $action): \Capell\AutomationStudio\Data\AutomationActionResultData { return $this->backend->handle($event, $action); }}
function registerAutomationActionHandlerAdapter(\Capell\AutomationStudio\Contracts\AutomationActionHandler $backend): void{ app()->bind(AutomationActionHandlerAdapter::class, static fn (): AutomationActionHandlerAdapter => new AutomationActionHandlerAdapter($backend)); app()->bind(\Capell\AutomationStudio\Contracts\AutomationActionHandler::class, AutomationActionHandlerAdapter::class);}Action dispatchAutomationTrigger
Section titled “Action dispatchAutomationTrigger”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runDispatchAutomationTrigger(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, ?string $idempotencyKey = null, ?int $siteId = null, int $attemptNumber = 1, ?int $maxAttempts = null, ?\Capell\AutomationStudio\Support\AutomationRuleRegistry $rules = null, ?\Capell\AutomationStudio\Support\AutomationActionRegistry $actions = null, ?\Capell\AutomationStudio\Actions\PersistAutomationTriggerResultsAction $persistResults = null): array{ return \Capell\AutomationStudio\Actions\DispatchAutomationTriggerAction::run($event, $idempotencyKey, $siteId, $attemptNumber, $maxAttempts, $rules, $actions, $persistResults);}Action dryRunAutomationRules
Section titled “Action dryRunAutomationRules”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runDryRunAutomationRules(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, ?int $siteId = null): array{ return \Capell\AutomationStudio\Actions\DryRunAutomationRulesAction::run($event, $siteId);}Action loadPersistedAutomationRules
Section titled “Action loadPersistedAutomationRules”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runLoadPersistedAutomationRules(?int $siteId = null): \Illuminate\Support\Collection{ return \Capell\AutomationStudio\Actions\LoadPersistedAutomationRulesAction::run($siteId);}Action persistAutomationTriggerResults
Section titled “Action persistAutomationTriggerResults”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runPersistAutomationTriggerResults(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, array $results, ?string $idempotencyKey = null, ?int $siteId = null, int $attemptNumber = 1, ?int $maxAttempts = null): void{ \Capell\AutomationStudio\Actions\PersistAutomationTriggerResultsAction::run($event, $results, $idempotencyKey, $siteId, $attemptNumber, $maxAttempts);}Action queueAutomationTrigger
Section titled “Action queueAutomationTrigger”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runQueueAutomationTrigger(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, ?int $siteId = null, ?string $idempotencyKey = null, ?string $deduplicationKey = null): string{ return \Capell\AutomationStudio\Actions\QueueAutomationTriggerAction::run($event, $siteId, $idempotencyKey, $deduplicationKey);}Action reapStaleAutomationRuns
Section titled “Action reapStaleAutomationRuns”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runReapStaleAutomationRuns(?int $staleAfterMinutes = null, ?int $limit = null): int{ return \Capell\AutomationStudio\Actions\ReapStaleAutomationRunsAction::run($staleAfterMinutes, $limit);}Action recordAutomationRun
Section titled “Action recordAutomationRun”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runRecordAutomationRun(\Capell\AutomationStudio\Data\AutomationTriggerEventData $event, ?\Capell\AutomationStudio\Models\AutomationRule $rule = null, ?\Capell\AutomationStudio\Data\AutomationRuleActionData $action = null, ?\Capell\AutomationStudio\Data\AutomationActionResultData $result = null, ?int $siteId = null, ?string $idempotencyKey = null, int $attemptNumber = 1, ?int $maxAttempts = null): \Capell\AutomationStudio\Models\AutomationRun{ return \Capell\AutomationStudio\Actions\RecordAutomationRunAction::run($event, $rule, $action, $result, $siteId, $idempotencyKey, $attemptNumber, $maxAttempts);}Action registerAutomationStudioDefaults
Section titled “Action registerAutomationStudioDefaults”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runRegisterAutomationStudioDefaults(): void{ \Capell\AutomationStudio\Actions\RegisterAutomationStudioDefaultsAction::run();}Action replayAutomationRun
Section titled “Action replayAutomationRun”<?phpdeclare(strict_types=1);
namespace App\CapellExamples\AutomationStudio;
function runReplayAutomationRun(\Capell\AutomationStudio\Models\AutomationRun $run): array{ return \Capell\AutomationStudio\Actions\ReplayAutomationRunAction::run($run);}