adsazad/symfony-etagging
Symfony bundle that adds easy ETag support to any Response. Inject EtaggingInterface and wrap rendered responses with etagResponse() to enable caching/conditional requests. Supports custom headers plus configurable max-age and shared max-age.
composer require adsazad/symfony-etagging
etagResponse() function will work on any symfony response.
// Add at the top of class
use Adsazad\SymfonyEtaggingBundle\Util\EtaggingInterface;
// Your action
public function myaction(Request $request, EtaggingInterface $etag){
$response = $this->render('mypage.twig',['parameters'=>'p1']);
// Return Etag Response
return $etag->etagResponse($response);
}
Add This before Etag Response
// Add Costum Headers
$ets->addCustom($key, $value);
// Set Max Age In Seconds (Default 1 Day)
$ets->setMaxAge(60*60*24); // 1 Day
// Set Max Age In Seconds (Default 1 Day)
$ets->setSharedMax(60*60*10); // 10 Hours
How can I help you explore Laravel packages today?