This repository contains a Slim Framework HTTP cache middleware and service provider.
Via Composer
$ composer require slim/http-cacheRequires Slim 3.0.0 or newer.
$app = new \Slim\App();
// Register middleware
$app->add(new \Slim\HttpCache\Cache('public', 86400));
// Register service provider
$app->register(new \Slim\HttpCache\CacheProvider);
// Example route with ETag header
$app->get('/foo', function ($req, $res, $args) {
$resWithEtag = $this['cache']->withEtag($res, 'abc');
return $resWithEtag;
});
$app->run();$ phpunitPlease see CONTRIBUTING for details.
If you discover any security related issues, please email security@slimframework.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.