An open API service indexing awesome lists of open source software.

https://github.com/zamronypj/zzzmiddleware

Cache middleware for Slim Framework 3.0
https://github.com/zamronypj/zzzmiddleware

cache-library php slim-3 slim-framework slim-middleware zzzcache

Last synced: 5 months ago
JSON representation

Cache middleware for Slim Framework 3.0

Awesome Lists containing this project

README

          

# zzzmiddleware
Cache middleware for Slim Framework 3.0 using ZzzCache

# Requirement
- [PHP >= 5.4](https://php.net)
- [Composer](https://getcomposer.org)
- [Slim Framework 3.0](https://slimframework.com)
- [ZzzCache](https://github/zamronypj/zzzcache)

# Installation
Run through composer

$ composer require juhara/zzzmiddleware

# How to use

### Register CacheMiddleware to Slim Dependency Container

get(CacheInterface::class);
$factory = new ResponseCacheFactory();
return new CacheMiddleware($cache, $factory);
};

### Add CacheMiddleware to Slim Application

use Slim\App;
use Juhara\CacheMiddleware\CacheMiddleware;

$app = new App($settings);
...
$app->add(CacheMiddleware::class);

### Create Proper Configuration

If using `Juhara\ZzzCache\Storages\File` as storage, then you need to make sure
that directory of cache is writeable by web server.

## Example

See [example application](https://github.com/zamronypj/zzzappexample) to understand
how to use CacheMiddleware.

## Contributing

Just create PR if you want to improve it.

Thank you.