This repository contains a Slim Framework HTTP cache middleware and service provider.
Via Composer
$ composer require slim/http-cache
Requires Slim 4.0.0 or newer.
declare(strict_types=1); use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; require __DIR__.'/../vendor/autoload.php'; $app = \Slim\Factory\AppFactory::create(); // Register the http cache middleware. $app->add(new \Slim\HttpCache\Cache('public', 86400)); // Create the cache provider. $cacheProvider = new \Slim\HttpCache\CacheProvider(); // Register a route and let the closure callback inherit the cache provider. $app->get( '/', function (Request $request, Response $response, array $args) use ($cacheProvider): Response { // Use the cache provider. $response = $cacheProvider->withEtag($response, 'abc'); $response->getBody()->write('Hello world!'); return $response; } ); $app->run();
Please 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4