PhpRedis for Lumen 5.*
- Move cache driver to
Target\PHPRedis\Cache
. - Add a Queue driver.
- Install PhpRedis
- Run
composer require targetliu/phpredis
- Configure redis in .env
- Add
$app->register(TargetLiu\PHPRedis\PHPRedisServiceProvider::class);
in bootstrap/app.php
- Add
$app->register(TargetLiu\PHPRedis\Cache\CacheServiceProvider::class);
in bootstrap/app.php in order to use PhpRedis with Lumen cache - Add
'phpredis' => [
'driver' => 'phpredis'
],
to stores in config/cache.php or vendor/larvel/lumen-framework/config/app.php in order to use PhpRedis with Lumen cache
- Set
CACHE_DRIVER=phpredis
in .env
- Add
$app->register(TargetLiu\PHPRedis\Queue\QueueServiceProvider::class);
in bootstrap/app.php in order to use PhpRedis with Lumen queue - Add
'phpredis' => [
'driver' => 'phpredis',
'connection' => 'default',
'queue' => 'default',
'expire' => 60,
],
to connections in config/queue.php or vendor/larvel/lumen-framework/config/queue.php in order to use PhpRedis with Lumen queue
- Set
QUEUE_DRIVER=phpredis
in .env
- With
app('phpredis')
, read PhpRedis document - With
app('cache')
, read Lumen document - With
app('queue')
, read Lumen document
This is just an example.