diff --git a/README.md b/README.md index 777d3db..912a872 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,13 @@ $app->add(new \Slim\HttpCache\Cache('public', 86400)); $container = $app->getContainer(); // Register service provider -$container->register(new \Slim\HttpCache\CacheProvider); +$container['cache'] = function () { + return new \Slim\HttpCache\CacheProvider(); +}; // Example route with ETag header $app->get('/foo', function ($req, $res, $args) { - $resWithEtag = $this['cache']->withEtag($res, 'abc'); + $resWithEtag = $this->cache->withEtag($res, 'abc'); return $resWithEtag; }); diff --git a/src/CacheProvider.php b/src/CacheProvider.php index 3cfa5b3..e39cbad 100644 --- a/src/CacheProvider.php +++ b/src/CacheProvider.php @@ -2,22 +2,10 @@ namespace Slim\HttpCache; use InvalidArgumentException; -use Pimple\Container; -use Pimple\ServiceProviderInterface; use Psr\Http\Message\ResponseInterface; -class CacheProvider implements ServiceProviderInterface +class CacheProvider { - /** - * Register this cache provider with a Pimple container - * - * @param Container $container - */ - public function register(Container $container) - { - $container['cache'] = $this; - } - /** * Enable client-side HTTP caching *