symfony2 Request Access to Request in a Twig or PHP template.


Example

In Twig template, Request object is available at

{{ app.request }}

When you want display request method in Twig, try this:

<p>Request method: {{ app.request.method }}</p>

In PHP template

<p>Request method: <?php echo $app->getRequest()->getMethod() ?></p>