2017 © Pedro Peláez
 

library zzzmiddleware

A cache middleware for Slim Framework (3.0) using ZzzCache

image

juhara/zzzmiddleware

A cache middleware for Slim Framework (3.0) using ZzzCache

  • Friday, July 13, 2018
  • by zamronypj
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

zzzmiddleware

Cache middleware for Slim Framework 3.0 using ZzzCache, (*1)

Requirement

Installation

Run through composer, (*2)

$ composer require juhara/zzzmiddleware

How to use

Register CacheMiddleware to Slim Dependency Container

<?php
...
use Juhara\ZzzCache\Contracts\CacheInterface;
use Juhara\ZzzCache\Cache;
use Juhara\ZzzCache\Storages\File;
use Juhara\ZzzCache\Helpers\ExpiryCalculator;
use Juhara\ZzzCache\Helpers\Md5Hash;

$container[CacheInterface::class] = function ($c) {
    // create a file-based cache where all cache
    // files is stored in directory name
    // app/storages/cache with
    // filename prefixed with string 'cache'
    return new Cache(
        new File(
            new Md5Hash(),
            'app/storages/cache/',
            'cache'
        ),
        new ExpiryCalculator()
    );
};

use Juhara\CacheMiddleware\CacheMidleware;
use Juhara\CacheMiddleware\ResponseCacheFactory;

$container[CacheMiddleware::class] = function ($c) {
    $cache = $c->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., (*3)

Example

See example application to understand how to use CacheMiddleware., (*4)

Contributing

Just create PR if you want to improve it., (*5)

Thank you., (*6)

The Versions

13/07 2018

dev-master

9999999-dev

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

12/04 2018

v1.0.15

1.0.15.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

11/04 2018

v1.0.14

1.0.14.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

11/04 2018

v1.0.13

1.0.13.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

10/04 2018

v1.0.12

1.0.12.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

10/04 2018

v1.0.11

1.0.11.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3

10/04 2018

v1.0.10

1.0.10.0

A cache middleware for Slim Framework (3.0) using ZzzCache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Zamrony P. Juhara

middleware cache php library slim slim-3