Step Types
Step types define the behavior of each step in a workflow. Workflowable ships with two built-in types and supports registering custom types.
Built-in Step Types
| Type | Description |
|---|---|
| Action | Executes a registered handler class that performs business logic |
| Conditional | Evaluates a condition and branches the workflow |
How Steps Work
Each step in a workflow definition has a type field that determines how it executes:
php
'steps' => [
'process_order' => [
'type' => 'action', // Step type
'handler' => 'process_order', // Type-specific config
],
'check_amount' => [
'type' => 'conditional',
'handler' => 'is_high_value',
],
]When the engine reaches a step, it:
- Resolves the step type from the
StepTypeRegistry - Creates a
StepExecutionrecord - Calls the step type's
execute()method with the step definition andExecutionContext - Uses the result to determine the next transition
Custom Step Types
Need domain-specific step behavior? You can create your own step types by implementing the StepType interface.