parsaaghayi-backend/vendor/symfony/routing
parsa aghaei 640bd67556
Some checks failed
Deploy Backend / deploy (push) Failing after 1m13s
chore: commit vendor for offline build
2026-06-28 16:47:17 +03:30
..
Annotation chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Attribute chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
DependencyInjection chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Exception chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Generator chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Loader chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Matcher chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Requirement chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
Alias.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
CHANGELOG.md chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
CompiledRoute.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
composer.json chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
LICENSE chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
README.md chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
RequestContext.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
RequestContextAwareInterface.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Route.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
RouteCollection.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
RouteCompiler.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
RouteCompilerInterface.php chore: commit complete vendor (Liara mirror no dist) 2026-06-23 15:37:41 +00:00
Router.php chore: commit vendor for offline build 2026-06-28 16:47:17 +03:30
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

Help Symfony by sponsoring its development!

Resources