Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you can do is use the cmd with (up to SF2.6)</p> <pre><code>php app/console router:debug </code></pre> <p>With SF 2.7 the command is</p> <pre><code>php app/console debug:router </code></pre> <p>With SF 3.0 the command is</p> <pre><code>php bin/console debug:router </code></pre> <p>which shows you all routes.</p> <p>If you define a prefix per controller (which I recommend) you could for example use</p> <pre><code>php app/console router:debug | grep "&lt;prefixhere&gt;" </code></pre> <p>to display all matching routes</p> <p>To display get all your routes in the controller, with basically the same output I'd use the following within a controller (it is the same approach used in the router:debug command in the symfony component)</p> <pre><code>/** * @Route("/routes", name="routes") * @Method("GET") * @Template("routes.html.twig") * * @return array */ public function routeAction() { /** @var Router $router */ $router = $this-&gt;get('router'); $routes = $router-&gt;getRouteCollection(); foreach ($routes as $route) { $this-&gt;convertController($route); } return [ 'routes' =&gt; $routes ]; } private function convertController(\Symfony\Component\Routing\Route $route) { $nameParser = $this-&gt;get('controller_name_converter'); if ($route-&gt;hasDefault('_controller')) { try { $route-&gt;setDefault('_controller', $nameParser-&gt;build($route-&gt;getDefault('_controller'))); } catch (\InvalidArgumentException $e) { } } } </code></pre> <p>routes.html.twig</p> <pre><code>&lt;table&gt; {% for route in routes %} &lt;tr&gt; &lt;td&gt;{{ route.path }}&lt;/td&gt; &lt;td&gt;{{ route.methods|length &gt; 0 ? route.methods|join(', ') : 'ANY' }}&lt;/td&gt; &lt;td&gt;{{ route.defaults._controller }}&lt;/td&gt; &lt;/tr&gt; {% endfor %} &lt;/table&gt; </code></pre> <p>Output will be:</p> <p><code>/_wdt/{token} ANY web_profiler.controller.profiler:toolbarAction</code> etc.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload