parsaaghayi-backend/vendor/symfony/routing
DevOps 3aad54907e
Some checks failed
Deploy Backend / deploy (push) Failing after 3m44s
chore: commit complete vendor (Liara mirror no dist)
2026-06-23 15:37:41 +00:00
..
Annotation chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Attribute chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
DependencyInjection chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Exception chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Generator chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Loader chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Matcher chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Requirement chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Alias.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
CHANGELOG.md chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
CompiledRoute.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
composer.json chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
LICENSE chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
README.md chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RequestContext.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RequestContextAwareInterface.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Route.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RouteCollection.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RouteCompiler.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RouteCompilerInterface.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Router.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
RouterInterface.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00

Routing Component

The Routing component maps an HTTP request to a set of configuration variables.

Getting Started

composer require symfony/routing
use App\Controller\BlogController;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

$route = new Route('/blog/{slug}', ['_controller' => BlogController::class]);
$routes = new RouteCollection();
$routes->add('blog_show', $route);

$context = new RequestContext();

// Routing can match routes with incoming requests
$matcher = new UrlMatcher($routes, $context);
$parameters = $matcher->match('/blog/lorem-ipsum');
// $parameters = [
//     '_controller' => 'App\Controller\BlogController',
//     'slug' => 'lorem-ipsum',
//     '_route' => 'blog_show'
// ]

// Routing can also generate URLs for a given route
$generator = new UrlGenerator($routes, $context);
$url = $generator->generate('blog_show', [
    'slug' => 'my-blog-post',
]);
// $url = '/blog/my-blog-post'

Sponsor

The Routing component for Symfony 7.1 is backed by redirection.io.

redirection.io logs all your websites HTTP traffic, and lets you fix errors with redirect rules in seconds. Give your marketing, SEO and IT teams the right tool to manage your website traffic efficiently!

Help Symfony by sponsoring its development!

Resources