1. Go to this page and download the library: Download asiries335/redis-stream-php 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/ */
asiries335 / redis-stream-php example snippets
use Asiries335\redisSteamPhp\Dto\StreamCommandCallTransporter;
// Example use in your app.
class Config implements \Asiries335\redisSteamPhp\ClientRedisStreamPhpInterface {
private $client;
public function __construct()
{
$this->client = new \Redis();
$this->client->connect('127.0.0.1', '6379');
}
/**
* Method for run command of redis
*
* @param StreamCommandCallTransporter $commandCallTransporter
*
* @return mixed
*
* @throws \Dto\Exceptions\InvalidDataTypeException
* @throws \Dto\Exceptions\InvalidKeyException
*/
public function call(StreamCommandCallTransporter $commandCallTransporter)
{
// Example use.
return $this->client->rawCommand(
$commandCallTransporter->get('command')->toScalar(),
...$commandCallTransporter->get('args')->toArray()
);
}
}
$client = new \Asiries335\redisSteamPhp\Client(new Config());