Repolode
symfony

symfony/routing

A PHP component that matches incoming HTTP request URLs to route configurations and generates URLs from named routes.

Stars
7,611
Forks
92
Open issues
0
Last commit
19 hours ago

What is it?

Symfony Routing maps an HTTP request to a set of configuration variables. You define routes with a path pattern such as /blog/{slug} and a set of default values like a controller class, then the matcher turns an incoming URL into those values, including the route name and any captured parameters.

The same route definitions work in reverse. The URL generator builds a path from a route name and parameters, so application code can link to pages without hard-coding URLs. The component is a standalone package and can be installed with Composer, independent of the full Symfony framework.

Key features

  • 01Matches request URLs to routes and returns route parameters.
  • 02Generates URLs from route names and parameters.
  • 03Defines routes with path placeholders and default values.
  • 04Installs as a standalone package via Composer.

Use cases

  • Building a PHP application that needs URL routing without the full framework.
  • Generating consistent links from named routes across templates and code.
  • Mapping REST-style paths like /blog/{slug} to controller actions.

Quick start

  1. 1

    Install the package with Composer

    composer require symfony/routing
  2. 2

    Define a route and a RouteCollection, then match a URL with UrlMatcher

Topics

FAQ

What is routing?
A PHP component that matches incoming HTTP request URLs to route configurations and generates URLs from named routes. Symfony Routing maps an HTTP request to a set of configuration variables. You define routes with a path pattern such as /blog/{slug} and a set of default values like a controller class, then the matcher turns an incoming URL into those values, including the route name and any captured parameters.
Is routing free to use? What license does it have?
routing is open source under the MIT license. Check the license terms before using it in commercial products.
Is routing still maintained?
Actively maintained. The last commit to routing was on Oct 24, 2026.
What can I use routing for?
Building a PHP application that needs URL routing without the full framework. Generating consistent links from named routes across templates and code. Mapping REST-style paths like /blog/{slug} to controller actions.
How do I install routing?
Install the package with Composer: composer require symfony/routing Define a route and a RouteCollection, then match a URL with UrlMatcher
Where can I get routing?
The source code and installation instructions are on GitHub: https://github.com/symfony/routing

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects