Business Workflows
Three shapes of durable workflows in PHP — Stateless Workflows, Sagas, and Orchestrators. Pick the one that matches your process, on the database and broker you already run.
Three Shapes of Durable Workflows
Shape
Pick when
Durability mechanism
Where state lives
Stateless Workflows — when the message is the state
#[CommandHandler(routingKey: 'order.place', outputChannelName: 'order.verify_payment')]
public function placeOrder(PlaceOrder $command): OrderData { /* ... */ }
#[Asynchronous('async')]
#[InternalHandler(inputChannelName: 'order.verify_payment', outputChannelName: 'order.ship')]
public function verifyPayment(OrderData $order): OrderData { /* ... */ }
#[Asynchronous('async')]
#[InternalHandler(inputChannelName: 'order.ship', outputChannelName: 'order.notify')]
public function ship(OrderData $order): OrderData { /* ... */ }Sagas — when state must persist between events
Orchestrators — when the step list is the workflow (Enterprise)
How to Choose
Materials
Demo implementation
Links
Last updated
Was this helpful?