PHP code example of lanfix / yii2-redis-pub-sub
1. Go to this page and download the library: Download lanfix/yii2-redis-pub-sub 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/ */
lanfix / yii2-redis-pub-sub example snippets
web.php
php
'redisPubSub' => [
'class' => 'lanfix\redis_pub_sub\RedisPubSub',
'connect' => [
'hostname' => 'localhost',
'port' => 6379,
'password' => ''
]
],
php
Yii::$app->redisPubSub->subscribe('my-channel-name', function($message) {
var_dump($message);
});