Access to route parameters can be obtained as follows in Twig:
{{ app.request.attributes }}
You can also use the dump() function to find out which methods are available:
<pre> {{ dump(app.request.attributes }} </pre>
Here is a dump of all parameters:
URL request
http://example.com/test/3 Route = test Slug = {param1} = 3
Twig Code
{{ dump(app.request.attributes) }}
Returns
object(Symfony\Component\HttpFoundation\ParameterBag)[10] protected 'parameters' => array (size=3) '_controller' => string 'MyTest\Bundle\Controller\TestController::indexAction' (length=61) 'param1' => string '3' (length=1) '_route' => string 'test' (length=7)
source share