- Notifications
You must be signed in to change notification settings - Fork98
Maps an HTTP request to a set of configuration variables
License
NotificationsYou must be signed in to change notification settings
symfony/routing
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Routing component maps an HTTP request to a set of configuration variables.
composer require symfony/routing
useApp\Controller\BlogController;useSymfony\Component\Routing\Generator\UrlGenerator;useSymfony\Component\Routing\Matcher\UrlMatcher;useSymfony\Component\Routing\RequestContext;useSymfony\Component\Routing\Route;useSymfony\Component\Routing\RouteCollection;$route =newRoute('/blog/{slug}', ['_controller' => BlogController::class]);$routes =newRouteCollection();$routes->add('blog_show',$route);$context =newRequestContext();// Routing can match routes with incoming requests$matcher =newUrlMatcher($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 =newUrlGenerator($routes,$context);$url =$generator->generate('blog_show', ['slug' =>'my-blog-post',]);// $url = '/blog/my-blog-post'
The Routing component for Symfony 7.1 isbacked byredirection.io.
redirection.io logs all your website’s HTTP traffic, and lets you fix errorswith redirect rules in seconds. Give your marketing, SEO and IT teams theright tool to manage your website traffic efficiently!
Help Symfony bysponsoring its development!
About
Maps an HTTP request to a set of configuration variables
Topics
Resources
License
Code of conduct
Security policy
Stars
Watchers
Forks
Packages0
No packages published