willdurand/propel-eventdispatcher-behavior
Propel behavior that integrates Symfony’s EventDispatcher into your model classes. Add it to your Propel config and schema to auto-generate an EventDispatcher per ActiveRecord class via getEventDispatcher(), enabling event-driven hooks in models.
Illuminate\Events). However, Laravel’s built-in event system is more mature and integrated, reducing the need for this behavior unless working with Propel1 (Laravel primarily uses Eloquent).EventDispatcher, but requires manual synchronization with Laravel’s event system.UserCreatedEvent) without tight coupling to controllers/services.<behavior name="event_dispatcher"> to schema.xml, which may conflict with Laravel Migrations if not managed carefully.Event::dispatch(), Bus for commands). Replicating this with Symfony’s EventDispatcher adds complexity.EventDispatcher instances may introduce memory overhead compared to Laravel’s centralized event system.Event facade directly in Propel models (if possible).dev-master is unstable; prefer a stable release if available).propel.ini/build.properties and update schema.xml.EventDispatcherBehavior).// In a Laravel service provider
$dispatcher = app('events')->dispatcher;
$propelDispatcher = PropelModel::getEventDispatcher();
$propelDispatcher->addListener('user.created', function ($event) use ($dispatcher) {
$dispatcher->dispatch(new UserCreated($event->getUser()));
});
~1.6 (check for breaking changes in newer Propel1 versions).symfony/event-dispatcher may conflict. Use composer require symfony/event-dispatcher:^3.0 explicitly.symfony/event-dispatcher and propel/propel1 versions explicitly in composer.json.illuminate/events).schema.xml modifications require Propel rebuilds (php propel build), which may need CI/CD pipeline updates.Monolog channels for Propel and Laravel events).EventDispatcher instances may increase memory usage compared to Laravel’s centralized dispatcher.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Propel event not dispatched | Silent failures if not logged. | Add logging for all Propel events. |
| Event listener conflicts | Duplicate or missing event handling. | Use unique event namespaces (e.g., propel.user.created). |
| Symfony/Laravel dependency conflict | Application crashes during autoloading. | Isolate dependencies (e.g., use composer.json aliases). |
| Schema migration issues | Propel rebuild fails, breaking models. | Backup schema.xml and test migrations in staging. |
| Event bridge listener fails | Propel events lost in Laravel system. | Implement retries (e.g., Laravel’s ShouldQueue for critical events). |
| PHP version incompatibility | Package fails to load. | Use Docker/PHP version pinning in CI/CD. |
$model->getEventDispatcher()->dispatch('event.name', $data);Event::listen('propel.event.name', ...);EventServiceProvider integration).How can I help you explore Laravel packages today?