Symfony Routing
Maps HTTP requests to controllers and generates URLs from named routes
Repository Health
Technical Analysis
Symfony Routing is the standalone PHP component that maps an incoming HTTP request to a set of configuration variables (typically a controller and its arguments) and, in reverse, generates URLs from named routes and parameters. It compiles a RouteCollection into an efficient matcher and generator, supporting route loading from PHP attributes, YAML, XML, or plain PHP closures.
As one of Symfony’s oldest and most widely used components (created in 2011, with 251 contributors and 100+ tagged releases), it powers routing inside the full Symfony framework but is fully decoupled and usable standalone in any PHP >=8.4 project. It supports route requirements/constraints, localized routes, host matching, redirect handling, and compiled matchers/generators for production performance.
What You Get
Route/RouteCollectionclasses for defining path patterns, HTTP methods, requirements, defaults, and host constraintsUrlMatcher/CompiledUrlMatcherfor resolving an incoming request path to a route name and its parametersUrlGenerator/CompiledUrlGeneratorfor building URLs from a route name and parameter array, including absolute URLs and locale-aware routes- Multiple route loaders — PHP attributes (
#[Route]), YAML, XML, PHP closures, and PSR-4 directory scanning — for defining routes in whatever format fits the project RedirectableUrlMatcherfor handling trailing-slash and scheme redirects, and aTraceableUrlMatcherfor debugging route resolution
Common Use Cases
- Routing HTTP requests to controllers in a Symfony application via attribute-, YAML-, or PHP-defined routes
- Generating canonical or localized URLs for links and redirects from a route name rather than hardcoding paths
- Adding routing to a standalone PHP microframework or micro-service without pulling in the full Symfony stack
- Compiling routes ahead of time into an optimized matcher/generator for production performance at scale
Under The Hood
Architecture - RouteCollection holds Route objects (path, methods, requirements, defaults, host); RouteCompiler compiles each Route into a CompiledRoute with precomputed regex and variable lists, which UrlMatcher/CompiledUrlMatcher (Matcher/) use to resolve requests and UrlGenerator/CompiledUrlGenerator (Generator/) use to build URLs, while Loader/ (attribute, YAML, XML, PHP-closure loaders) populates the collection from various source formats. Tech Stack - Pure PHP 8.4+, decoupled from the rest of Symfony except symfony/deprecation-contracts, with optional integrations (dev-only requires) for symfony/config, symfony/expression-language, symfony/dependency-injection, symfony/http-foundation, and symfony/yaml when those features are used. Code Quality - A mature, heavily tested component (242 PHP files including an extensive Tests/ suite) maintained by 251 contributors with 100+ tagged releases and active current development (7.33 commits/month), reflecting Symfony’s rigorous BC-policy and semantic-versioning discipline. API Design - The matcher/generator split, PSR-4-friendly attribute-based route loading, and compiled artifacts (CompiledRoute, CompiledUrlMatcher) give a clean separation between declarative route definition and high-performance runtime resolution, with RouterInterface as the small, stable contract other Symfony components and third-party integrations depend on.
Used by 4 apps in this directory
EspoCRM
Marketing · Ecommerce · CRM
Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.
FreeScout
Customer Support
Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.
Mautic
Automation · Marketing · Ecommerce
The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.
wallabag
Bookmarks Archiving
Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.