Tutorial by Examples

<?php use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; class TestController extends Controller { //Inject Request HTTP Component in your function then able to exploit it public function myFunctionAction(Request $request) {...
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>...

Page 1 of 1