$response = new Symfony\Component\HttpFoundation\Response(); $response->setContent('Hello World!'); $response->setETag();
$response = new Symfony\Component\HttpFoundation\Response(); $response->setContent('Hello World!'); $response->setETag('abc123');
$response = new Symfony\Component\HttpFoundation\Response(); $response->setContent('Hello World!'); $response->setETag('abc123'); // Check for If-None-Match header $request = Symfony\Component\HttpFoundation\Request::createFromGlobals(); if ($request->headers->has('If-None-Match') && $request->headers->get('If-None-Match') == $response->getETag()) { // Return 304 not modified response $response->setStatusCode(304); $response->setContent(null); } $response->send();The Response setETag method is part of the Symfony HttpFoundation component, which is a PHP package/library for creating HTTP responses and requests.