ez-php / cache
Cache module for the ez-php framework — array, file, and Redis drivers with a unified interface
0.2.0
2026-03-15 03:47 UTC
Requires
- php: ^8.5
- ez-php/framework: 0.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^13.0
README
Cache module for the ez-php framework — array, file, and Redis drivers with a unified interface.
Requirements
- PHP 8.5+
- ez-php/framework ^1.0
- ext-redis (for Redis driver)
Installation
composer require ez-php/cache
Setup
Register the service provider:
$app->register(\EzPhp\Cache\CacheServiceProvider::class);
Configure the driver in config/cache.php:
return [ 'driver' => env('CACHE_DRIVER', 'array'), // array | file | redis 'path' => storage_path('cache'), 'redis' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'port' => (int) env('REDIS_PORT', 6379), ], ];
Usage
$cache = $app->make(\EzPhp\Cache\CacheInterface::class); $cache->put('key', 'value', ttl: 3600); $value = $cache->get('key'); $cache->forget('key');
License
MIT — Andreas Uretschnig