adsazad/symfony-etagging

etagging bundle for symfony

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 1

Type:symfony-bundle

v1.3 2020-05-13 11:23 UTC

README

Installation

composer require adsazad/symfony-etagging

Usage

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 Custom Headers

Add This before Etag Response

// Add Costum Headers
  $ets->addCustom($key, $value);

Set Max Age

// 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