# composer.json
"minimum-stability": "dev",
"prefer-stable": true,
$ composer require "al-one/laravel-predis-listened" -vvv
# optional if >= 5.5
# config/app.php
<?php
return [
'providers' => [
Alone\LaravelPredisListened\ServiceProvider::class,
],
];
# config/database.php
<?php
return [
'redis' => [
'client' => 'predis_listened',
],
];
use Alone\LaravelPredisListened\RedisEvent;
Facades\Event::listen(RedisEvent::class,function(RedisEvent $event)
{
$event->command; // Redis命令
$event->arguments; // 参数
$event->time; // 耗时
});
MIT