Simple PHP client library for the Redis protocol.
- PHP 5.3+
Download via Composer
Create a composer.json
file if you don't already have one in your projects root directory and require redis_protocol:
{
"require": {
"sandeepshetty/redis_protocol": "dev-master"
}
}
Install Composer:
$ curl -s http://getcomposer.org/installer | php
Run the install command:
$ php composer.phar install
This will download redis_protocol into the vendor/sandeepshetty/redis_protocol
directory.
To learn more about Composer visit http://getcomposer.org/
callable redis_protocol\client( [string $host = '127.0.0.1' [, int $port = 6379]] )
The returned function accepts a Redis command as a string.
<?php
require 'vendor/sandeepshetty/redis_protocol/client.php';
use sandeepshetty\redis_protocol;
$redis = redis_protocol\client();
var_dump($redis('SET foo "bar baz"')); // bool(true)
var_dump($redis('GET foo')); // string(7) "bar baz"
$redis('QUIT');
?>
Support for Pipelining and Clustering.