dualmedia/symfony-doctrine-event-converter-bundle
prePersist, postUpdate) with Symfony’s event system, enabling a cleaner separation of concerns. This aligns well with Laravel’s event-driven architecture (e.g., Model::saved(), Model::deleted()), though Laravel lacks Symfony’s formal event system.OrderCreatedEvent). Laravel’s ecosystem (e.g., laravel-echo, laravel-horizon) could leverage this for async processing.Symfony\Component\EventDispatcher). Laravel’s Event facade is incompatible without a wrapper layer (e.g., a custom bridge class).doctrine/dbal or illuminate/database. However, Laravel’s Eloquent is not Doctrine ORM, so integration would require:
Illuminate\Contracts\Foundation\Application or Illuminate\Database\Eloquent\Model lacks this interface. Would need custom traits or interface adoption.EventDispatcher) acceptable, or must the solution remain pure Laravel?Model::observe()) achieve the same goal with less overhead?spatie/laravel-event-sourcing are lighter alternatives.| Step | Action | Laravel Compatibility | Risk |
|---|---|---|---|
| 1 | Install Bundle | ❌ (Symfony dependency) | High |
| 2 | Configure bundles.php |
❌ (Laravel uses config/app.php) |
High |
| 3 | Implement IdentifiableInterface |
⚠️ (Custom trait needed) | Medium |
| 4 | Create Abstract Event Class | ✅ (Laravel supports abstract classes) | Low |
| 5 | Register Doctrine Event Subscribers | ❌ (Doctrine listeners ≠ Laravel service providers) | High |
| 6 | Bridge Symfony Events to Laravel | ⚠️ (Custom event dispatcher needed) | High |
Recommended Path for Laravel:
symfony/event-dispatcher and symfony/dependency-injection, adding ~5MB to vendor size.EventDispatcher won’t auto-register in Laravel’s container. Would need manual binding:
$app->bind('event.dispatcher', function ($app) {
return new \Symfony\Component\EventDispatcher\EventDispatcher();
});
symfony/ux-live-component or a separate Docker container).// Symfony Event Listener
$eventDispatcher->dispatch(new DoctrineEntityEvent($entity));
// Laravel Queue Job
Event::dispatch(new LaravelEntityEvent($entity->toArray()));
| Scenario | Impact | Mitigation |
|---|---|---|
| Symfony EventDispatcher fails to initialize | Events silently drop | Add fallback to Doctrine listeners |
| Cross-framework event serialization fails | Data corruption | Validate event payloads with JSON Schema |
| Queue backlog from event publishing | Delayed processing | Implement dead-letter queues |
| Doctrine entity changes bypass event system | Inconsistent state | Use Doctrine’s preFlush/postFlush as safety nets |
| Laravel service container conflicts | Dependency injection errors | Isolate Symfony components in a separate namespace |
EventSubscriberInterface vs. Laravel’s ShouldQueue/HandlesEvents.How can I help you explore Laravel packages today?