Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.91 KB

debug.rst

File metadata and controls

52 lines (37 loc) · 1.91 KB
.. index::
    single: Routing; Debugging

How to Visualize And Debug Routes

While adding and customizing routes, it's helpful to be able to visualize and get detailed information about your routes. A great way to see every route in your application is via the debug:router console command, which lists all the configured routes in your application:

$ php bin/console debug:router

------------------ -------- -------- ------ ----------------------------------------------
 Name               Method   Scheme   Host   Path
------------------ -------- -------- ------ ----------------------------------------------
 homepage           ANY      ANY      ANY    /
 contact            GET      ANY      ANY    /contact
 contact_process    POST     ANY      ANY    /contact
 article_show       ANY      ANY      ANY    /articles/{_locale}/{year}/{title}.{_format}
 blog               ANY      ANY      ANY    /blog/{page}
 blog_show          ANY      ANY      ANY    /blog/{slug}
------------------ -------- -------- ------ ----------------------------------------------

You can also get very specific information on a single route by including the route name as the command argument:

$ php bin/console debug:router article_show

# or use part of the name to search for routes
$ php bin/console debug:router blo

  Select one of the matching routes:
  [0] blog
  [1] blog_show
.. versionadded:: 4.1
    The feature to look for partial route names was introduced in Symfony 4.1.

Likewise, if you want to test whether a URL matches a given route, use the router:match command. This is useful to debug routing issues and find out which route is associated with the given URL:

$ php bin/console router:match /blog/my-latest-post

Route "blog_show" matches