Routes
One of the cornerstones of developing a Symfony application is working with routes. The routing infrastructure ensures that we can use readable URLs (for example, /products/hammer instead of index.php?page=products&productid=12345) and that these URLs are mapped to a controller in our application that can respond to requests.
The Symfony Plugin provides several facilities for working with routes.
Code completion for routes
PhpStorm provides code completion for functions that take a route name as an argument. In the editor, press Ctrl+Space to invoke code completion and do any of the following:
Specify arguments for such controller functions as
generateUrl
orforward
.Specify arguments for such Twig functions as
path
orcontroller
.
Navigation for routes
Since routes are linked to a controller, you can use Navigate to declaration Ctrl+B on a route to navigate to the corresponding controller. Alternatively, Ctrl+Click the service's name.
![Navigate to Symfony controller Navigate to Symfony controller](https://resources.jetbrains.com/help/img/idea/2022.1/ps_symfony_route_navigate_controller.png)
To navigate back to a route mapped to a controller, click the route icon in the editor gutter.
![Navigate to Symfony route Navigate to Symfony route](https://resources.jetbrains.com/help/img/idea/2022.1/ps_navigate_to_symfony_route.png)
Missing route inspection
Whenever you use the name of a route that is not defined or misspelled, PhpStorm displays the corresponding warning from the Missing Route inspection. .
![the Missing Route Symfony inspection the Missing Route Symfony inspection](https://resources.jetbrains.com/help/img/idea/2022.1/ps_symfony_missing_route_inspection.png)