PHP code example of al-one / laravel-predis-listened

1. Go to this page and download the library: Download al-one/laravel-predis-listened library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

al-one / laravel-predis-listened example snippets


# optional if >= 5.5
# config/app.php


return [

    'providers' => [
        Alone\LaravelPredisListened\ServiceProvider::class,
    ],

];

# config/database.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;      // 耗时
});