symfony/routing
54.2
Adequate · 14 November 2026
7.9k
lines of production code
PHP
primary language
7
measurements over time
What this system is
Features
Introduces PHP-DSL configurators for route definitions
Adds a new set of classes in the \Loader/Configurator\ namespace (\RoutingConfigurator\, \CollectionConfigurator\, \RouteConfigurator\, \ImportConfigurator\, \AliasConfigurator\, and \RoutesReference\) that provide a fluent, object-oriented API for defining routes in PHP configuration files. This allows users to configure route paths, hosts, prefixes, imports, and aliases using method chaining instead of traditional array structures, while also supporting environment-specific configuration via the \env()\ method.
Loader/Configurator · high confidence
New PHP DSL traits for route configuration
The routing loader configurator now includes a set of internal PHP traits (AddTrait, HostTrait, LocalizedRouteTrait, PrefixTrait, RouteTrait) that enable a fluent, object-oriented way to define routes. Users can now configure route properties such as paths, hosts, prefixes, locales, UTF-8 support, conditions, schemes, methods, controllers, and firewall associations using method chaining. This includes support for localized routes with per-locale paths and prefixes, route aliasing, and stateless route attributes.
Loader/Configurator/Traits · high confidence
New PHP attribute-based routing loaders
The Loader component introduces a new family of loaders to support PHP 8 attributes for route definitions. \AttributeClassLoader\ reads \\#\[Route\]\ attributes from classes and methods, while \AttributeFileLoader\ and \AttributeDirectoryLoader\ allow loading these routes from specific files or entire directories. \AttributeRouteControllerLoader\ automatically configures the \\_controller\ default based on the class and method names, and \AttributeServicesLoader\ enables auto-registering routes from tagged controller services. These new loaders replace the legacy annotation-based approach, providing a modern, native PHP syntax for defining routing.
Loader · high confidence
New Requirement namespace with universal route parameter patterns and EnumRequirement
The Symfony Routing component introduces a new \Symfony\\Component\\Routing\\Requirement\ namespace containing a \Requirement\ enum and an \EnumRequirement\ class. The \Requirement\ enum provides a collection of universal regular-expression constants for common route parameter validations, including specific patterns for MongoDB IDs, positive integers, ASCII slugs, dates, and various UUID versions (V1–V8) as well as ULIDs and base32/base58 formats. Additionally, the new \EnumRequirement\ class allows developers to generate route requirements dynamically from PHP \BackedEnum\ cases, simplifying the validation of route parameters against enum values.
Requirement · high confidence
New router:match command for debugging route matching
A new \router:match\ console command has been added to the Routing component, allowing users to simulate and debug route matching for a given path. The command accepts a required path argument and optional flags for HTTP method, scheme, and host, then reports which routes match, almost match, or do not match the provided criteria. When a route matches, it automatically invokes the \debug:router\ command to display detailed information about the matched route.
Command · high confidence
Routing component restructured as a standalone package with new RouterBundle and modernized core classes
The Symfony Routing component has been reorganized into a standalone package, introducing the \RouterBundle\ to handle configuration and service wiring previously managed by \FrameworkBundle\. Core classes like \Route\, \CompiledRoute\, and \RequestContext\ have been modernized with constructor property promotion, native types, and new serialization methods (\\_\serialize\/\\\_unserialize\) to replace deprecated \Serializable\ implementations. The \Route\ class now uses \path\ instead of \pattern\, and \RequestContext\ supports parameter injection and context isolation via \runWith()\. Additionally, new attributes like \\#\[AsRouteLoader\]\ and \\#\[AsRoutingConditionService\]\ replace older interfaces, and the component now includes a \CHANGELOG.md\ and \README.md\ for documentation.
(repo-wide) · high confidence
Removals
Removal of Resource interface and FileResource class from Routing component
The \Symfony\\Component\\Routing\\Resource\ namespace has been removed, specifically deleting the \ResourceInterface\ and \FileResource\ classes. This change eliminates the previous abstraction for representing filesystem-based routing resources, meaning any code relying on these specific classes for resource management or uptodate checks will no longer function as before.
Resource · high confidence
Architecture
Routing dependency injection logic moved to the Routing component
The dependency injection compiler passes and router implementation previously located in FrameworkBundle have been relocated to the Symfony Routing component. This change introduces new classes such as AddExpressionLanguageProvidersPass, LocalizedRoutesPass, RoutingControllerPass, and RoutingResolverPass to handle service registration and route configuration, while the Router class now implements ServiceSubscriberInterface and WarmableInterface to manage loader instantiation and cache warming directly within the component.
DependencyInjection · high confidence
Routing service definitions moved to dedicated configuration file
The service definitions for the routing system (including loaders, the router, cache warmers, and listeners) have been extracted from the main console configuration into a new dedicated \Resources/config/routing.php\ file. This change improves modularity by isolating routing-related services, while the \console.command.router\_match\ service remains in \Resources/config/console.php\.
Resources · high confidence
Behavioural changes
2 commits (0 fixes) modifying CacheWarmer, Controller
A change to existing behaviour in CacheWarmer, Controller — 2 commits, 2 files: “\[Cache\]\[FrameworkBundle\]\[Routing\]\[Serializer\]\[Translation\]\[TwigBundle\]\[Validator\] Preserve legacy types of moved services”; “\[FrameworkBundle\]\[Cache\]\[Routing\]\[Translation\] Move the classes CacheBundle, RouterBundle and TranslationBundle wire into their own components”.
CacheWarmer, Controller · medium confidence · unverified
Major overhaul of the XML routing schema (routing-1.0.xsd)
The XML routing schema has been significantly expanded and restructured to support new configuration capabilities. Key changes include the addition of environment-based conditional routing via the new \\<when\>\ element, support for internationalized routes with locale-specific paths and hosts, and the introduction of a \stateless\ attribute for routes and imports. The schema now allows importing resources with specific options (such as name prefixes, exclusions, and host/scheme/method constraints) and supports complex data types for defaults (lists and maps). Additionally, the namespace has been updated from symfony-project.org to symfony.com, and several attributes have been renamed or made required (e.g., \id\ is now required, \pattern\ is renamed to \path\).
Loader/schema/routing · high confidence
Refactored URL matching with request-aware interfaces and debuggability
The Matcher component has been refactored to improve request handling, debugging, and extensibility. A new RequestMatcherInterface and matchRequest() method allow matchers to operate directly on Request objects, enabling proper handling of HTTP methods and schemes. The UrlMatcher now implements this interface and supports expression language providers for dynamic route conditions. A new TraceableUrlMatcher provides detailed debugging traces for route matching failures. Additionally, new RedirectableUrlMatcher and CompiledUrlMatcher classes offer optimized and redirect-capable matching, while the legacy ApacheUrlMatcher has been removed.
Matcher · high confidence
Refactored routing matcher dumpers and introduced compiled route matching
The Matcher/Dumper component has been significantly refactored to improve performance and maintainability. The legacy PhpMatcherDumper and ApacheMatcherDumper classes have been removed and replaced by a new CompiledUrlMatcherDumper and CompiledUrlMatcherTrait, which generate optimized PHP arrays for a compiled URL matcher that processes static and dynamic routes more efficiently. Additionally, the base MatcherDumper and MatcherDumperInterface have been updated to use constructor property promotion and modern PHP syntax, and a new StaticPrefixCollection class has been added to handle route prefix grouping and ordering.
Matcher/Dumper · high confidence
Replaced class-based URL generator with compiled array dumper
The Routing component's generator dumper has shifted from producing a PHP class (PhpGeneratorDumper) to generating a static PHP array (CompiledUrlGeneratorDumper). This change improves performance by allowing the generator to operate on a pre-compiled array structure rather than instantiating and calling methods on a generated class. The base dumper classes now use constructor property promotion and expose routes via a getter, while the interface now explicitly defines the dump method as returning a string representation of executable code.
Generator/Dumper · high confidence
Routing attributes now support multiple environments, aliases, and firewall configuration
The \\#\[Route\]\ attribute in the \Symfony\\Component\\Routing\\Attribute\ namespace has been updated to allow defining multiple environments via the \env\ parameter (accepting a string or array), support route aliases through the \alias\ parameter (including deprecation metadata via \DeprecatedAlias\), and specify a firewall name via the \firewall\ parameter. Additionally, new attributes \AsRouteLoader\ and \AsRoutingConditionService\ have been introduced to mark services as route loaders and routing condition services respectively, enabling cleaner service-based routing configurations.
Attribute · high confidence
Routing exceptions now implement Symfony's ExceptionInterface
The Symfony Routing component's exception classes (such as ResourceNotFoundException, MethodNotAllowedException, and RouteNotFoundException) now implement the new ExceptionInterface, which extends PHP's native \\Throwable. This change allows applications to catch all routing-related errors via a single interface, improving consistency with other Symfony components and enabling more robust error handling for routing failures.
Exception · high confidence
URL generation behavior and configuration overhaul
The URL generator now implements the ConfigurableRequirementsInterface, allowing you to disable strict parameter validation via setStrictRequirements() to prevent exceptions during generation (useful for production environments with third-party parameters). The generate() method signature has changed to use named constants (ABSOLUTE\_URL, ABSOLUTE\_PATH, RELATIVE\_PATH, NETWORK\_PATH) instead of a boolean, and it now supports internationalized routes by automatically resolving locale-specific route aliases. Additionally, a new CompiledUrlGenerator class is introduced to generate URLs from pre-compiled route data for improved performance, and URL encoding rules have been adjusted to comply with RFC 3986, specifically handling query string parameters and path segments more strictly.
Generator · high confidence
Test coverage
2 commits adding/updating tests in Tests/Fixtures/controller\_shortcuts; Add test fixtures for missing PHP start tags and variadic route arguments; Added comprehensive unit tests for the UrlGenerator component; Added test fixtures for PSR-4 controller directory loading; Added test fixtures for attribute parameter ordering; Added test fixtures for attributed routing classes; Added test fixtures for compiled URL matchers; Added test fixtures for enum types; Added test fixtures for glob pattern routing imports; Added test fixtures for locale-specific host routing; Added test fixtures for localized routing and UTF-8 support; Added test fixtures for route aliasing; Added test fixtures for the new PHP 8 Route attribute; Added tests for CompiledUrlGeneratorDumper; Added tests for Route attribute configuration; Added tests for RouterCacheWarmer, RedirectController, and routing fixtures; Added tests for Routing dependency injection compiler passes and router; Added tests for localized prefix alias handling; Added tests for new Routing Requirement constants and EnumRequirement; Added tests for the compiled URL matcher dumper and static prefix collection; Added unit tests for the RouterMatchCommand; Added unit tests for the Routing Matcher components; Added unit tests for the Routing component; Added unit tests for the Routing component's loader classes; Expanded test fixtures for routing configuration and loading.
Dependencies
Initial composer.json for Symfony Routing
Added the composer.json manifest for the symfony/routing component, establishing a minimum PHP version of 8.4.1 and defining runtime dependencies on symfony/deprecation-contracts. The file also specifies development dependencies for testing and integration with other Symfony components (such as config, console, and http-kernel versions 7.4 and 8.0) and enforces a conflict with symfony/dependency-injection versions prior to 8.2.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 53 → 54 (+1.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 57 → 56 (-0.5)
- Architecture 84 → 99 (+14.3)
- Maturity 46 → 46 (+0.1)
- Readiness 47 → 46 (-0.2)
- Security 100 → 100 (+0.0)
Resolved (7)
- Change coupling: CompiledUrlMatcherTrait.php ↔ UrlMatcher.php (Matcher/Dumper/CompiledUrlMatcherTrait.php)
- Duplicated block (5 lines × 2) (Loader/ContentLoaderTrait.php)
- Duplicated block (8 lines × 2) (Loader/ContentLoaderTrait.php)
- Duplicated block (9–11 lines × 2) (Loader/ContentLoaderTrait.php)
- Hotspot: Generator/UrlGenerator.php (Generator/UrlGenerator.php)
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
New (12)
- CompiledUrlMatcherDumper.compileDynamicRoutes (cognitive 43) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- CompiledUrlMatcherDumper.compileDynamicRoutes (cyclomatic 19) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- CompiledUrlMatcherDumper.getCompiledRoutes (cognitive 32) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- CompiledUrlMatcherDumper.getCompiledRoutes (cyclomatic 19) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- CompiledUrlMatcherDumper.groupStaticRoutes (cognitive 25) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- Duplicated block (17 lines × 2) (Loader/ContentLoaderTrait.php)
- Duplicated block (8 lines × 2) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- Duplicated block (9 lines × 2) (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- Hotspot: Matcher/Dumper/CompiledUrlMatcherDumper.php (Matcher/Dumper/CompiledUrlMatcherDumper.php)
- Hotspot: Matcher/Dumper/CompiledUrlMatcherTrait.php (Matcher/Dumper/CompiledUrlMatcherTrait.php)
- Off-boarding risk: anonymized user #1
- RouteCompiler.compile (cognitive 18) (RouteCompiler.php)
Changes since last survey
- 40 commits — 35 feature/other, 5 fixes
By area
- (repo) — 25 commits
- Matcher/Dumper — 4 commits
- (root) — 3 commits
- Tests/Fixtures — 2 commits
- DependencyInjection/Router.php — 1 commit
- Loader/DelegatingLoader.php — 1 commit
- Loader/PhpFileLoader.php — 1 commit
- Loader/XmlFileLoader.php — 1 commit
- Tests/Loader — 1 commit
- Tests/RouteCompilerTest.php — 1 commit
Notable commits
- fix: [Config][Routing] Fix excluded paths in XML route imports and in GlobResource ids
- fix: [Routing] Fix compiled matchers accepting extra trailing slashes on static routes
- fix: [Routing] Fix the order of routes with host variables in compiled matchers
- fix: bug #67924 [Cache][FrameworkBundle][Routing][Serializer][Translation][TwigBundle][Validator] Preserve legacy types of moved services (X-Coder264)
- fix: bug #68014 [Routing] Fix the order of routes with host variables in compiled matchers (nicolas-grekas)
- change: Merge branch '5.4' into 6.4
- change: Merge branch '5.4' into 6.4
- change: Merge branch '5.4' into 6.4
- change: Merge branch '5.4' into 6.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '6.4' into 7.4
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- change: Merge branch '7.4' into 8.1
- …and 20 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
symfony/routing was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 704e20a95f1dbe2a4a784eeb092d6ea472accdd7 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-859b6d22580d.