SensioFrameworkExtraBundle

Annotation-driven controller configuration for Symfony — routes, param converters, and security checks via docblocks

Library
Composer
vv6.2.10
3,351stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
41/100Fair
Development Activity0
Maintenance0
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
57/100Fair
Architecture65
Code Quality60
Innovation45
Learning Curve58

SensioFrameworkExtraBundle was, for years, the standard way to configure Symfony controllers declaratively: @Route annotations for routing, @ParamConverter to auto-resolve entities from route parameters, @Security/@IsGranted for access checks, and @Template/@Cache for view and HTTP-caching shortcuts, all attached directly to controller methods via docblock annotations rather than separate YAML/XML config files.

The bundle predates PHP native attributes; once PHP 8 attributes and Symfony’s own built-in attribute support (Symfony 6.2+) matured, the project’s maintainers marked it unmaintained and pointed users to Symfony core’s native equivalents. It remains widely installed (nearly 900K monthly Packagist downloads) because a large body of existing Symfony applications, tutorials, and legacy projects still depend on its annotation syntax, and migrating away requires touching every annotated controller.

What You Get

  • @Route annotation support for defining URL routes inline on controller methods (predates Symfony’s own routing annotations)
  • @ParamConverter for automatically resolving Doctrine entities (or custom converters) from route/request parameters into typed method arguments
  • @Security/@IsGranted annotations for expressing access-control checks alongside the action they protect
  • @Template for rendering a Twig template inferred from the controller/action name without an explicit render() call
  • @Cache for declaring HTTP cache headers (expiration, ETag, vary) directly on the action

Common Use Cases

  • Maintaining legacy Symfony 4/5 applications that were built around annotation-based controller configuration
  • Auto-resolving Doctrine entities from route parameters (/post/{id} → a hydrated Post entity argument) without manual repository lookups in every action
  • Keeping routing and access-control declarations co-located with the controller method they apply to for readability
  • Bridging older Symfony codebases before a planned migration to native PHP 8 attributes and Symfony’s built-in equivalents

Under The Hood

Architecture — The bundle hooks into Symfony’s kernel request lifecycle as an event subscriber layer (src/EventListener) combined with a compiler pass (src/DependencyInjection/Compiler) that scans controller classes for annotations at container-compile time. ParamConverter implementations (src/Request/ParamConverter) run during the kernel.controller_arguments event, intercepting the resolved controller arguments and replacing scalar route parameters with hydrated objects (most commonly Doctrine entities) before the controller body executes. Routing annotations are parsed via doctrine/annotations and fed into Symfony’s routing component as an alternate route-loader, meaning routes defined this way are indistinguishable from YAML/XML routes once compiled. Security and caching annotations similarly translate into standard Symfony security voter calls and Response cache-header manipulation, wrapping functionality that already exists in Symfony core behind a more compact syntax. Tech Stack — PHP 7.2+/Symfony 4.4-6.x era bundle built on doctrine/annotations for docblock parsing and the standard Symfony component set (config, dependency-injection, framework-bundle, http-kernel). It is explicitly not updated for Symfony 7 compatibility. Code Quality — A moderately sized codebase (~30 PHP files under src/) organized by concern (Configuration, Security, Templating, Request/ParamConverter, Routing, EventListener), with an extensive dev-dependency test setup (Doctrine ORM/DBAL, browser-kit, dom-crawler) reflecting integration-level testing against real Symfony application behavior. API Design — The whole point of the bundle was ergonomics: annotations collapse what would otherwise be several lines of YAML routing config plus manual EntityManager lookups into a single docblock line above the method signature, at the cost of coupling controller code to annotation parsing overhead and, eventually, to a now-unmaintained dependency.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search