ashleydawson/domain-event-dispatcher
Event facade, Bus for async). This could lead to duplication of concerns if Laravel’s ecosystem is already in use.__invoke() magic method, which is a clean PHP pattern.JsonSerializable or Serializable). This could be a blocker if domain events contain non-serializable dependencies (e.g., database connections, closures).Event facade?Event + Queue)?Event + Queue is more feature-rich).Event facade (benchmark if needed).DomainEventDispatcher usages with either:
Event facade (recommended for Laravel apps), orcomposer require ashleydawson/domain-event-dispatcher
DomainEventDispatcher::getInstance()->addListener().DomainEventDispatcher::getInstance()->dispatch($event).composer.json to avoid accidental updates.Event + Queue for async support.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Singleton corruption (e.g., race condition) | Listeners not invoked or duplicate events | Use Laravel’s container instead of singleton |
| Non-serializable event | Event dispatch fails silently | Validate events pre-dispatch or refactor |
| Listener throws unhandled exception | Event system fails catastrophically | Add global exception handling |
| Package incompatibility with PHP 8.x | Integration breaks | Fork and update the package |
| High listener latency | System slowdowns | Move listeners to queues |
__invoke listeners).__invoke().How can I help you explore Laravel packages today?