Skip to content

Inline Symbols

Inline symbols indicate references within a line.

@ (Actor)

Reference to a machine/actor:

flow
machine: @order
on :checkout from @customer (api)
emit :request to @payment

: (Event)

Reference to an event:

flow
on :checkout from @customer (api)
emit :payment_request to @payment
on :payment_success from @payment

# (State)

Reference to a machine state:

flow
order moves to #pending
? order is in #paid
order transitions to #completed

$ (Context Variable)

Reference to context data:

flow
$total becomes 100
$items adds "Laptop"
? $total > 0

With type annotation:

flow
$total: number becomes 100
$items: array adds "Laptop"

Type Annotations

Optional types for context variables:

TypeDescriptionExample
stringText values$name: string becomes "John"
numberIntegers and decimals$total: number becomes 100
booleanTrue/false$active: boolean becomes true
arrayList of items$items: array becomes empty
objectKey-value pairs$config: object becomes empty

^ (Binding Transformer)

Reference to a binding transformer for complex response transformations:

flow
on :get_order_report from @admin (api)
  reply 200 with ^order_report

Binding transformers:

  • Execute code that transforms response data
  • Handle complex business logic not expressible in EventFlow
  • Map to PHP/JS classes with the #[ResponseTransformer] attribute
php
#[ResponseTransformer('order_report')]
class OrderReportTransformer {
    public function transform(Context $context): array {
        return [
            'summary' => $this->buildSummary($context),
            'charts' => $this->generateChartData($context),
        ];
    }
}

See Machine Responses for details.

Released under the MIT License.