draw/workflow
draw/workflow is a Laravel/PHP package for modeling and running workflows. Define steps and transitions, track state changes, and execute processes consistently across your application. Useful for approvals, onboarding flows, and other multi-step business processes.
EventDispatcher or Laravel’s native event system.spatie/laravel-workflow) or Symfony’s core workflow fall short. Ideal for products requiring:
workflow component may limit Laravel-native projects unless abstracted via a bridge (e.g., symfony/event-dispatcher in Laravel). Assess whether the product’s workflows are Symfony-centric or can tolerate a hybrid approach.EventDispatcher in Laravel (via symfony/event-dispatcher package) to leverage the package’s event-driven extensions.draw/workflow features into Laravel’s Events/Listeners pattern. Example:
// Laravel Event Listener for Workflow Extensions
class WorkflowExtensionListener
{
public function handle(WorkflowTransitionEvent $event)
{
$extension = new CustomWorkflowExtension();
$extension->onTransition($event->workflow, $event->entity, $event->transition);
}
}
Stateful services or policy guards) if the package’s overhead isn’t justified.draw/security and draw/dependency-injection may introduce unnecessary complexity in a Laravel stack. Evaluate whether these dependencies are critical or can be mocked/replaced.spatie/laravel-workflow).Why Not Native Laravel?
Stateful services, policy guards, or event listeners without external dependencies?draw/workflow guards with Laravel’s Gate or Policy classes.Symfony vs. Laravel Tradeoffs
Feature Criticality
Security Implications
draw/security integration introduce unnecessary complexity (e.g., RBAC logic) when Laravel’s Gate system suffices?Migration Strategy
EventDispatcher (via symfony/event-dispatcher) to bridge events.Events system to wrap draw/workflow extensions.spatie/laravel-workflow) and lacks Symfony dependencies.Assessment Phase:
Incremental Adoption:
if (config('features.workflow_extensions')) {
$workflow->apply($entity, $transition);
} else {
// Fallback to custom logic
}
Fallback Strategy:
try {
$workflow->apply($entity, $transition);
} catch (WorkflowException $e) {
logger()->error("Workflow failed, falling back to custom logic", ['error' => $e]);
// Custom fallback logic
}
symfony/event-dispatcher and symfony/workflow if missing:
composer require symfony/event-dispatcher symfony/workflow
Events/Listeners can coexist with Symfony’s EventDispatcher.draw/* packages and existing symfony/* dependencies.conflict-resolution or aliases if needed.Dependency Setup:
composer require draw/workflow draw/security draw/dependency-injection
EventDispatcher in Laravel’s config/app.php:
'providers' => [
Symfony\Component\EventDispatcher\EventDispatcherProvider::class,
],
Configuration:
// app/Providers/AppServiceProvider.php
public function register()
{
$this->app->singleton(WorkflowInterface::class, function ($app) {
return new Workflow($app->make(EventDispatcherInterface::class));
});
}
config/workflows.php (Symfony-style YAML or Laravel’s array format).Testing:
Deployment:
$workflow->on('transition', function ($event) {
logger()->debug('Workflow transition', $event->getTransition());
});
How can I help you explore Laravel packages today?