Symfony 8.1 introduces dynamic controller attributes, a significant improvement over the previous static reflection-only approach. Attributes like #[Cache], #[IsGranted], and #[Template] are now stored in a request attribute (_controller_attributes), allowing event listeners to override them at runtime without modifying source code. The update also adds a flat list retrieval mode for getAttributes(), exposes controllerArgumentsEvent on ResponseEvent, and introduces dedicated per-attribute kernel events following the convention {kernelEvent}.{AttributeFQCN}. This enables clean, decoupled attribute-based listeners — demonstrated with a custom #[RateLimit] attribute example. Built-in listeners have been migrated to the new system.
Table of contents
Decoupled Controller AttributesFlat List of Controller AttributesEvents Named After Controller Attributes12.4K Impressions