get request parameters symfony 4 code example
Example 1: symfony get post params
use Symfony\Component\HttpFoundation\Request;
$request = Request::createFromGlobals();
$request->getPathInfo();
$request->query->get('id');
$request->request->get('category', 'default category');
$request->server->get('HTTP_HOST');
$request->files->get('attachment');
$request->cookies->get('PHPSESSID');
$request->headers->get('host');
$request->headers->get('content-type');
$request->getMethod();
$request->getLanguages();
Example 2: symfony request get all parameters
$params = $this->getRequest()->request->all();
$params['value1'];
$params['value2'];