symfony/event-dispatcher
Symfony EventDispatcher component lets application parts communicate via events. Dispatch events and register listeners or subscribers to react to them, enabling decoupled, extensible architectures with a lightweight, reusable event system.
EventDispatcher for advanced patterns (e.g., priority listeners, propagation control). Maintains compatibility with Laravel’s Event facade and Listener contracts.TraceableEventDispatcher optimizations persist for long-running processes.#[AsEventListener] attribute remains fully functional, enabling runtime listener toggling without code changes.Event facade and Listener interfaces. No breaking changes to existing workflows.#[AsEventListener].FrameworkBundle (e.g., #[AsEventListener]), with Laravel abstractions mitigating learning curves.v8.1.0-BETA3. Memory leak fixes from v8.0.9 (TraceableEventDispatcher) remain intact.v8.1.0-BETA3: Minor bug fixes (e.g., #64262) but no breaking changes or new features. Low risk for production adoption if stability is prioritized over bleeding-edge updates.v8.0.0 remain; ensure Laravel’s PHP version aligns (PHP 8.4+ for full feature set).#[AsEventListener]) require documentation but offer no new complexity.EventDispatcherInterface in unit tests (use Laravel’s EventServiceProvider or Symfony’s interfaces).v8.1.0 stable release (expected Q3 2024) or adopt v8.1.0-BETA3 for minor bug fixes (#64262)?v8.0.9 (stable) unless specific fixes in v8.1.0-BETA3 are critical.Event system?TraceableEventDispatcher be used in high-frequency loops? Confirm v8.0.9 fixes suffice.Listener interfaces over #[AsEventListener].Event facade; no changes to existing Event::dispatch() calls.#[AsEventListener], EventDispatcherInterface) for advanced use cases.v8.1.0-BETA3 for long-running workers.symfony/event-dispatcher:^8.0.9 (recommended for production).symfony/event-dispatcher:^8.1.0-BETA3 only if fixes in #64262 are critical.composer.json:
"require": {
"symfony/event-dispatcher": "^8.0.9" // or "^8.1.0-BETA3"
}
#[AsEventListener] (optional; Laravel’s Listener interfaces work unchanged).AuthService::verify() with event(new VerificationRequested)).TraceableEventDispatcher in queue workers and long-running CLI scripts.stopPropagation()) in critical paths.EventDispatcherInterface is a drop-in replacement.illuminate/events. Most packages support Symfony’s interface.v8.0.9 (stable) unless v8.1.0-BETA3 fixes are critical.User::updateProfile() with event(new ProfileUpdated)).#[AsEventListener] reduces repetitive listener registration code.v8.1.0-BETA3: Monitor for final release notes before upgrading from v8.0.9.TraceableEventDispatcher to log event flows (enabled via EventDispatcher::setDebug(true)).#[AsEventListener] (PHP 8.0+ attributes). Laravel’s make:listener works unchanged.Event facade remains functional; rollback to v8.0.9 is trivial.OrderCreated).v8.1.0-BETA3.PaymentService listens to OrderPaid).| Risk | Mitigation | Severity |
|---|---|---|
| Listener Exceptions | Use try-catch in listeners or Symfony’s EventDispatcher::addListener() with error handlers. |
Medium |
| Memory Leaks (TraceableEventDispatcher) | v8.0.9 fixes persist; test in long-running processes. |
Low |
| Event Storm | Rate-limit dispatchers or use queues (e.g., dispatchSync() vs. dispatch()). |
High |
| Circular Dependencies | Refactor to |
How can I help you explore Laravel packages today?