Skip to content

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

TypeDescription
ActionExecutes a registered handler class that performs business logic
ConditionalEvaluates 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:

  1. Resolves the step type from the StepTypeRegistry
  2. Creates a StepExecution record
  3. Calls the step type's execute() method with the step definition and ExecutionContext
  4. 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.