Symfony 8.2 to Add Compiled Event Dispatcher and Deprecate Runtime Listener Changes

A PHP poster from The Drop Times titled "What Can Be Ready Before a Request?" featuring the Symfony logo and a row of upright green panels connected through a shared system, with one panel illuminated in orange. The illustration represents Symfony moving known event listener preparation outside individual requests to reduce unnecessary processing while preserving the performance benefits of its optimized dispatcher.

Symfony 8.2 will introduce a compiled event dispatcher that prepares listener configuration during container compilation rather than rebuilding it for every request. Symfony's 7 October 2026 technical article, published by Javier Eguiluz and crediting contributor Nicolas Grekas, describes the change alongside deprecations affecting runtime listener registration. Version 8.2 is scheduled for November 2026 and remains under development.

The shared event_dispatcher service will use CompiledEventDispatcher, which receives an ordered array of listener service IDs and methods, together with a service locator. PHP's OPcache can store the array in shared memory, avoiding the runtime closure setup previously performed for each request. Listener services remain lazy: they are instantiated only when they need to run.

Benchmark Measures Dispatcher Creation, Not Page Speed

In Symfony's implementation benchmark, a configuration with 75 listeners across 31 events reduced dispatcher creation time from 33.7 to 0.48 microseconds, approximately a 70-fold change in that operation. The earlier listener closures also occupied about 97 KB of memory, which the compiled implementation no longer needs for those closures. These measurements are specific to dispatcher setup; they do not establish a comparable reduction in complete request times or performance improvements for Drupal sites.

Runtime Listener Changes Are Deprecated

Symfony 8.2 deprecates calls to addListener(), addSubscriber(), removeListener() and removeSubscriber() on the shared event_dispatcher service. Modifying the shared listener set at runtime forces a fallback to the regular dispatcher, forfeiting the compiled setup benefit. Symfony recommends registering permanent listeners as services and using the new ScopedEventDispatcher for temporary listeners. Only events dispatched through the scoped wrapper reach its additional listeners.

Functional tests that attach listeners directly to the shared dispatcher should instead register the listeners as services in the test environment. Event dispatch performance and lazy listener loading are otherwise intended to remain unchanged, and existing listener and subscriber registrations benefit without being rewritten.

Autowiring Changes Affect Dispatcher Interfaces

Autowiring the shared dispatcher through Symfony\Component\EventDispatcher\EventDispatcherInterface is also deprecated. Services that only dispatch events should use Symfony\Contracts\EventDispatcher\EventDispatcherInterface. Symfony introduces Symfony\Contracts\EventDispatcher\ListenerIntrospectionInterface for tools that need to inspect registered listeners and their priorities.

Drupal teams have reason to follow the upstream changes because Drupal relies on Symfony components. A Drupal core policy discussion identifies Symfony 8.2 as a possible dependency for Drupal 12 if the release aligns with December 2026. That discussion is not confirmation of the final dependency selection, and Symfony's benchmark does not measure the effect on Drupal. Any implications for Drupal integrations or custom event-dispatcher use should be assessed against the Symfony version actually adopted.

Disclosure: This content is produced with the assistance of AI.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Upcoming Events

Latest Opportunities