symfony/workflow
Symfony Workflow Component helps you model and run workflows or finite state machines in PHP. Define places, transitions, and guards to control state changes, track progress, and integrate with events for process automation.
is_approved, is_processed) with a centralized workflow system, reducing technical debt and improving maintainability. Ideal for complex domains like order processing, content moderation, or HR pipelines.user.tier >= 'premium'), replacing manual flag checks and enabling data-driven decisions.BackedEnum). Symfony’s Workflow is battle-tested (used by Sentry, Shopware) and aligns with Laravel’s ecosystem.OrderShipped) for notifications, analytics, or async tasks (via Laravel Queues). Supports real-time integrations with third-party services.Adopt when:
order.shipped, log to audit table).workflow:dump CLI).Avoid when:
is_active toggle → use Eloquent accessors or spatie/laravel-state-machine).spatie/laravel-state-machine for 2-state processes).Executives: *"Symfony Workflow is a proven, enterprise-grade solution for managing complex business processes—like order fulfillment, content approvals, or user onboarding—with zero manual errors and full auditability. Here’s why it’s a game-changer for us:
if-else logic with declarative workflows (e.g., cart → checkout → shipped → delivered). Used by Sentry, Shopware, and Blackfire to streamline critical processes.# config/workflows/order.yaml
support:
places: [cart, checkout, shipped, delivered, cancelled]
transitions:
checkout: { from: cart, to: checkout }
ship: { from: checkout, to: shipped, guard: 'order.is_payable()' }
OrderShipped) for:
TraceableWorkflow to log every transition with timestamps, enabling compliance and debugging.AppServiceProvider:
$this->app->bind('order_workflow', fn() => new Workflow(new YamlFileLoader(__DIR__.'/workflows/order.yaml')));
MethodMarkingStore:
$store = new MethodMarkingStore($order, 'status');
$workflow->apply($store, 'ship'); // Updates $order->status = 'shipped'
workflow:dump CLI command.spatie/laravel-state-machine (Laravel-native, lighter).Let’s start with a pilot—this could save us hundreds of dev hours and reduce bugs long-term."*
How can I help you explore Laravel packages today?