parsaaghayi-backend/vendor/symfony/routing
DevOps c9a688e80d
Some checks failed
Deploy Backend / deploy (push) Has been cancelled
chore: commit vendor directory for fully offline builds
2026-06-28 18:08:40 +00:00
..
Annotation chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Attribute chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
DependencyInjection chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Exception chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Generator chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Loader chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Matcher chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Requirement chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Alias.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
CHANGELOG.md chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
CompiledRoute.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
composer.json chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
LICENSE chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
README.md chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RequestContext.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RequestContextAwareInterface.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Route.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RouteCollection.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RouteCompiler.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RouteCompilerInterface.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
Router.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +00:00
RouterInterface.php chore: commit vendor directory for fully offline builds 2026-06-28 18:08:40 +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

Help Symfony by sponsoring its development!

Resources