How to view all defined routes in Symfony 2 PHP application

Every so often it is useful to list all of the defined routes in your Symfony application, whether to find out the name of the route, or to debug why a route is being used unexpectedly (routes are called based on the first one that matches). To view the routes, simply type the following in the console:

php app/console debug:router


php bin/console debug:router

depending on your version.