PHP code example of johnnylei / yii-redis-queue

1. Go to this page and download the library: Download johnnylei/yii-redis-queue 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/ */

    

johnnylei / yii-redis-queue example snippets


// 前台发送
Yii::$app->redis_queue->publish('test', 'xxxxxxxxxxxxxxx');

// console里面监听,并且处理,设置监听不超时
ini_set('default_socket_timeout', -1);
Yii::$app->redis_queue->subscribe('test', function($instance, $channelName, $message) {
    var_dump($message);
});
 php
'redis_queue'=>[
    'class'=>'johnnylei\redis_queue\RedisQueue',
],