Redis database plugin for the aztech/event-bus
library. For more information on event-bus
, see that library's readme.
Composer is the only supported way of installing aztech/event-bus-extra-redis . Don't know Composer yet ? Read more about it.
$ composer require "aztech/event-bus-extra-redis":"~1"
To use this plugin, you first need to register it with the Event factory. The easiest way is as follows :
<?php
require_once 'vendor/autoload.php';
use \Aztech\Events\Events;
use \Aztech\Events\Bus\Plugins\Redis\Redis;
Redis::loadPlugin('redis');
$publisher = Events::createPublisher('redis');
$processor = Events::createProcessor('redis');
// ...
By default, the plugin attempts to connect to a Redis server at localhost:6379, which suits mostly development machines.
You can configure the Redis client using the options array when using the Event factory.
<?php
require_once 'vendor/autoload.php';
use \Aztech\Events\Events;
use \Aztech\Events\Bus\Plugins\Redis\Redis;
Redis::loadPlugin('redis');
$publisher = Events::createPublisher('redis', [ 'host' => '192.168.1.1', 'port' => 6379);
// ...
The keenest readers will have noticed the options accepted are the same as those used by \Predis\Client
.