aboutcoders/workflow-bundle
Symfony bundle to define and manage workflows with optional GUI. Provides routing and ORM configuration, Twig helpers to render workflow configuration and history, and an AJAX endpoint to fetch execution history. Integrates with KnpMenuBundle and JobBundle.
Model::update(['status' => 'approved'])) with a more structured, auditable approach.AppKernel, YAML config, KnpMenuBundle dependency). Laravel’s service container and configuration (PHP arrays, config/workflow.php) will require abstraction layers or wrappers.spatie/laravel-menu or custom Blade components would need to be evaluated.laravel-horizon or spatie/laravel-queue could substitute, but workflow-specific job triggers would need customization.db_driver: orm). Laravel’s Eloquent is compatible but may require middleware to bridge Doctrine-specific features (e.g., lifecycle callbacks).routing.yml) clashes with Laravel’s routes/web.php. A facade or service provider would need to map Symfony routes to Laravel’s router.dev-master dependency suggest instability. Risk of breaking changes or abandoned maintenance.Workflow, Menu) lack Laravel equivalents, requiring significant customization.replace or provide to hide Symfony dependencies behind Laravel interfaces.WorkflowManager facade).spatie/laravel-activitylog + custom state machines) that reduce integration risk?| Symfony Component | Laravel Alternative | Notes |
|---|---|---|
| KnpMenuBundle | spatie/laravel-menu or custom |
For workflow visualization. |
| AbcJobBundleBundle | laravel-horizon or spatie/queue |
For async transitions. |
| Doctrine ORM | Eloquent | Use Eloquent events or observers. |
| Symfony Workflow | Custom service or spatie/laravel-workflow |
If available. |
spatie/laravel-workflow (if it exists; check Packagist).laravel-state-machine.Phase 1: Proof of Concept (2–4 weeks)
symfony/workflow package directly (no bundle).config/workflow.php.// config/workflow.php
return [
'order' => [
'supports' => [Order::class],
'places' => ['draft', 'submitted', 'approved', 'rejected'],
'transitions' => [
'submit' => ['from' => 'draft', 'to' => 'submitted'],
'approve' => ['from' => 'submitted', 'to' => 'approved'],
],
],
];
Order::apply('approve')).Phase 2: GUI Integration (2–3 weeks)
spatie/laravel-menu).{{ workflow_visualizer($order) }}).workflow_history table).Phase 3: Async Transitions (1–2 weeks)
AbcJobBundleBundle with Laravel queues.// Order model
public function apply(string $transition) {
$this->workflow->apply($this, $transition);
OrderApplied::dispatch($this); // Queue async events
}
Phase 4: Full Adoption (Ongoing)
Workflow uses dot notation for place/transition names (e.g., order.submit). Laravel’s snake_case convention may require normalization.prePersist) won’t work with Eloquent. Use Eloquent observers or model events instead.config.yml) to PHP arrays (config/workflow.php).Route::group to mimic Symfony’s prefix-based routing.$this->app->singleton('workflow.registry', function () {
return new \Symfony\Component\Workflow\Registry();
});
incrementing IDs (Doctrine’s default) or adjust workflow queries.if-else state checks across controllers.symfony/workflow may complicate future migrations.config/workflow.php with comments.workflow:debug Artisan command to dump current state/transitions.MarkingStore, Place).workflow:retry command for failed async transitions.workflow_events) may impact read performance. Consider indexing entity_id and occurred_at.How can I help you explore Laravel packages today?