donutloop/restful-api-workflow-bundle
Workflow component natively, requiring workarounds (e.g., custom event listeners, process managers).workflow component) can be adapted via Laravel’s config files or database-backed definitions.spatie/laravel-state-machine) could serve as a partial alternative.symfony/workflow, symfony/http-foundation, and api-platform/core. Laravel would need:
symfony/http-client for HTTP actions or spatie/laravel-symfony-support.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Dependency Overhead | High | Abstract workflow logic into a Laravel service layer or use API Platform as a bridge. |
| State Management Conflicts | Medium | Use Laravel’s Eloquent observers or model events to sync workflow states. |
| Async Workflow Support | Medium | Integrate with Laravel Queues or Symfony Messenger via custom listeners. |
| Testing Complexity | High | Adopt PestPHP for workflow state testing; mock Symfony components where needed. |
| Performance Overhead | Low | Benchmark workflow execution vs. native Laravel solutions (e.g., spatie/laravel-activity-log). |
Why Workflows?
spatie/laravel-state-machine) or adding orchestration for API compositions?Symfony vs. Laravel Trade-offs
illuminate/support)?Data Persistence
workflow_runs table or leverage existing audit logs?"Async vs. Sync Execution
Team Skill Set
Workflow component, or will training be required?nwidart/laravel-modules) to reduce ramp-up?"symfony/workflow via Composer (requires Laravel 9+ with Symfony 5.4+ compatibility).Assessment Phase:
spatie/laravel-state-machine, laravel-permission).Proof of Concept (PoC):
Incremental Adoption:
| Laravel Feature | Bundle Compatibility | Workaround |
|---|---|---|
| Eloquent ORM | Low (Doctrine-focused) | Use doctrine/dbal for DB access or sync states via model observers. |
| Laravel Queues | Medium (Async support limited) | Wrap workflow steps in queue jobs or use Symfony Messenger. |
| API Resources | High (API Platform integration) | Leverage api-platform/core for REST workflow triggers. |
| Authentication (Sanctum) | Medium (Symfony Security bundle preferred) | Use middleware to inject user context into workflows. |
| Testing (PestPHP) | Low (Symfony-specific tests) | Mock Symfony components or use Laravel’s HTTP tests. |
Prerequisites:
composer require symfony/workflow symfony/http-client api-platform/core
api-platform if using its workflow features.Core Integration:
config/packages/donutloop_restful_api_workflow.yaml (or custom config).use DonutLoop\RestfulApiWorkflowBundle\Workflow\WorkflowRunner;
$workflow = $this->container->get('donutloop_restful_api_workflow.workflow_runner');
$result = $workflow->run('user_onboarding', $userData);
// routes/api.php
Route::post('/workflows/{name}', [WorkflowController::class, 'run']);
Extensibility:
WorkflowActionInterface.Monitoring:
symfony/workflow component.workflow component will need training (e.g., states, transitions, guards).How can I help you explore Laravel packages today?