Skip to content

Configuration

Publish the configuration file:

bash
php artisan vendor:publish --tag="workflowable-config"

Full Configuration

php
// config/workflowable.php
return [
    /*
    |--------------------------------------------------------------------------
    | Actions
    |--------------------------------------------------------------------------
    |
    | Actions available to all workflows regardless of event type.
    |
    */
    'actions' => [
        // 'action_name' => \App\Actions\MyAction::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | Conditionals
    |--------------------------------------------------------------------------
    |
    | Conditionals available to all workflows regardless of event type.
    | Each class must implement the Conditional interface.
    |
    */
    'conditionals' => [
        // 'conditional_name' => \App\Conditionals\MyConditional::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | Workflow Events
    |--------------------------------------------------------------------------
    |
    | Register workflow event DTOs and their scoped actions and conditionals.
    |
    */
    'events' => [
        // 'event_name' => [
        //     'class' => \App\WorkflowEvents\MyEvent::class,
        //     'description' => 'Description of the event',
        //     'actions' => [
        //         'action_name' => \App\Actions\MyAction::class,
        //     ],
        //     'conditionals' => [
        //         'conditional_name' => \App\Conditionals\MyConditional::class,
        //     ],
        // ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Execution Settings
    |--------------------------------------------------------------------------
    */
    'execution' => [
        // Maximum steps per execution run (safety limit)
        'max_steps' => 1000,

        // Default retry policy for all steps (null = no retries)
        'default_retry' => null,
        // Example:
        // 'default_retry' => [
        //     'max_attempts' => 3,
        //     'backoff' => 'exponential',
        //     'delay_seconds' => 5,
        // ],

        // Queue name for dispatched workflow jobs
        'queue' => 'default',

        // Queue connection (null = app default)
        'connection' => null,
    ],
];

Configuration Details

actions

Actions registered here are available to all workflows. Use this for shared utility actions like sending emails or logging.

php
'send_email' => \App\Actions\SendEmail::class,

conditionals

Conditionals registered here are available to all workflows. Each class must implement the Conditional interface.

php
'is_high_value' => \App\Conditionals\IsHighValue::class,

events

Each event entry maps an event name to a WorkflowEvent DTO class and its scoped actions and conditionals:

php
'order_submitted' => [
    'class' => \App\WorkflowEvents\OrderSubmitted::class,
    'description' => 'Triggered when a new order is submitted',
    'actions' => [
        'process_order' => \App\Actions\ProcessOrder::class,
        'fulfill_order' => \App\Actions\FulfillOrder::class,
    ],
    'conditionals' => [
        'is_high_value' => \App\Conditionals\IsHighValue::class,
    ],
],

Actions and conditionals under their respective keys are only available to workflows bound to that specific event.

execution

KeyDefaultDescription
max_steps1000Maximum steps per execution run. Prevents infinite loops.
default_retrynullDefault retry policy applied to all steps unless overridden.
queue'default'Queue name for Workflowable::dispatch() jobs.
connectionnullQueue connection. null uses the app default.