$response = new Response('Hello World'); $response->send();
$response = new Response('Hello World'); $response->headers->set('Content-Type', 'text/html'); $response->send();
use Symfony\Component\HttpFoundation\JsonResponse; $data = array('name' => 'John', 'age' => 30); $response = new JsonResponse($data); $response->send();This code creates a JSON object with the data "name" and "age" and sends it as the HTTP response to the client. The Response send function is part of the Symfony HTTP Foundation package.