Skip to content
Branch: master
Go to file

Latest commit

ziogas committed ced67e4 Jun 6, 2017
Merge pull request #3 from nate8nate/patch-1
Fix the order on the EXPIRE command in Readme


Failed to load latest commit information.
Latest commit message
Commit time

PHP Redis implementation V2.1

Yet another php redis implementation. Raw wrapper for real Redis fans. Main advantages:

  • Doesn't require any dependencies as all the communication goes via tcp socket.
  • All commands are passed as is, so you have all the freedom to play with redis just like in redis-cli.
  • It won't get deprecated or obsolete for the same reason. You write raw commands by yourself.
  • Doesn't matter which redis version you have.
  • Supports chainable methods. Write multiple commands and send everything at once.
  • Custom error function to handle errors.
  • Dead Simple and lightweight, you're welcome to read all the 300+ lines of redis.php
  • Forces you to actually learn and understand redis data structures and commands.


You can checkout latest version with:

$ git clone git://


To install PHP redis:

  • Simply copy redis.php to your site and require it from external script

Here are some examples:

require 'redis.php';

function redis_error($error) {
    throw new error($error);

$redis = new redis_cli ();

$redis->cmd('SET', 'foo', 'bar')
      ->cmd('HSET', 'hash', 'field', 'val')
      ->cmd('EXPIRE', 'foo', 300)

$foo = $redis->cmd('GET', 'foo')->get();
$field = $redis->cmd('HGET', 'hash', 'field')->get();


More usage examples can be found on tests folder. For commands documentation just go directly to

Running tests

To run tests you'll need phpunit

Execute: phpunit tests/*


  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request


Arminas Zukauskas -

Based on


MIT Do whatever you want, attribution is nice but not required

You can’t perform that action at this time.