symfony createFromGlobals code example
Example 1: symfony request get all parameters
$params = $this->getRequest()->request->all();
$params['value1'];
$params['value2'];
Example 2: symfony set content type
use Symfony\Component\HttpFoundation\Response;
$response = new Response();
$response->setContent(json_encode([
'data' => 123,
]));
$response->headers->set('Content-Type', 'application/json');