PHPackages                             clue/redis-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. clue/redis-server

ActiveLibrary[Caching](/categories/caching)

clue/redis-server
=================

A redis server implementation in pure PHP

v0.1.0(11y ago)1941.3k35[6 PRs](https://github.com/clue/php-redis-server/pulls)MITPHPPHP &gt;=5.3

Since Jul 21Pushed 4y ago16 watchersCompare

[ Source](https://github.com/clue/php-redis-server)[ Packagist](https://packagist.org/packages/clue/redis-server)[ Docs](https://github.com/clue/php-redis-server)[ RSS](/packages/clue-redis-server/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (5)Versions (8)Used By (0)

clue/redis-server [![Build Status](https://camo.githubusercontent.com/ef2215e27eb2aab46587fc273b51f457b3e5bfb34c3d222a8594bca03d1bdeeb/68747470733a2f2f7472617669732d63692e6f72672f636c75652f7068702d72656469732d7365727665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/clue/php-redis-server)
================================================================================================================================================================================================================================================================================================================

[](#clueredis-server-)

A Redis server implementation in pure PHP. *Not for the faint-hearted.*

> Note: This project is in early alpha stage! Feel free to report any issues you encounter.

Introduction
------------

[](#introduction)

### Motivation

[](#motivation)

[Redis](http://redis.io/) is a fast in-memory key-value database. This project aims to provide a simple alternative to the official Redis server implementation if installing it is not an option.

Why would I use this project if I already have the official Redis server installed? Simply put, you wouldn't. Ever.

### Project goals

[](#project-goals)

- ✓ Implement an in-memory datastore using the Redis protocol
- ✓ Compatiblity with common Redis clients and tools
    - ✓ redis-cli
    - ✓ redis-benchmark
- ✓ SOLID and modern design, tested and modular components
- ✗ Implement *all* commands (see below for list of supported commands)

### Supported commands

[](#supported-commands)

Eventually, this project aims to replicate *all* commands of the [official Redis server](http://redis.io/) implementation and their exact behavior.

So far, the following list of commands shows what's already implemented:

- Keys
    - DEL
    - EXISTS
    - EXPIRE
    - EXPIREAT
    - KEYS
    - PERSIST
    - PEXPIRE
    - PEXPIREAT
    - PTTL
    - RANDOMKEY
    - RENAME
    - RENAMENX
    - SORT
    - TTL
    - TYPE
- Strings
    - APPEND
    - DECR
    - DECRBY
    - GET
    - GETRANGE
    - GETSET
    - INCR
    - INCRBY
    - MGET
    - MSET
    - MSETNX
    - PSETEX
    - SET
    - SETEX
    - SETNX
    - SETRANGE
    - STRLEN
- Lists
    - LINDEX
    - LLEN
    - LPOP
    - LPUSH
    - LPUSHX
    - LRANGE
    - RPOP
    - RPOPLPUSH
    - RPUSH
    - RPUSHX
- Connection
    - ECHO
    - PING
    - QUIT
    - SELECT
- Server
    - AUTH
    - CLIENT KILL
    - CLIENT LIST
    - CLIENT GETNAME
    - CLIENT SETNAME
    - CONFIG GET
    - CONFIG SET
    - DBSIZE
    - FLUSHALL
    - FLUSHDB
    - SHUTDOWN
    - TIME

For details, refer to the excellent official documentation of [Redis commands](http://redis.io/commands).

All available commands are expected to behave just like their counterparts in Redis v2.6+, unless otherwise noted. If you find a command to misbehave, don't hesitate to file a bug.

Obviously, this list is incomplete in that it does not include *every* command supported by Redis. If you find a command is missing, please submit a PR :)

### Benchmarking performance

[](#benchmarking-performance)

> As usual, just about *every* benchmark is biased - you've been warned.

You can use the `redis-benchmark` script that is included when installing the official Redis server.

```
$ redis-benchmark -p 1337 -q
```

Some benchmarking results:

```
# official redis-server
$ redis-server --port 1338
$ redis-benchmark -t set,get -p 1338 -q
SET: 121951.22 requests per second
GET: 151515.16 requests per second

# clue/redis-server PHP 5.5
$ php bin/redis-server.php
$ redis-benchmark -t set,get -p 1337 -q
SET: 18761.73 requests per second
GET: 22172.95 requests per second

# clue/redis-server HHVM
$ hhvm -vEval.Jit=true bin/redis-server.php
$ redis-benchmark -t set,get -p 1337 -q
SET: 49019.61 requests per second
GET: 57142.86 requests per second

```

So depending on your configuration, expect the original implementation to be 2x to 5x as fast. Some thoughts that have a significant effect on the performance:

- HHVM is significantly faster than standard PHP (2.5x)
- Installing `ext-libevent` (not available for HHVM unfortunately) will significantly improve the performance for concurrent connections. This is not a hard requirement, but `redis-benchmark` defaults to 50 concurrent connections which slows down the whole server process due to relying on a `stream_select()` call otherwise.
- The `bin/redis-server.php` includes a `$debug` flag (which defaults to `false`). Disabled debugging output significantly improves performance (3x)
- The benchmark should not be run from within a virtual machine. Running this on the host machine instead shows significant improvements (8x). For comparision, the same applies to official Redis, although it shows a smaller impact (3x).

Quickstart example
------------------

[](#quickstart-example)

Once [installed](#install), you can start the Redis server by running the provided bin file:

```
$ php bin/redis-server.php
```

Alternatively, you can also use this project as a lib in order to build your own server like this:

```
$factory = new Factory($loop);
$factory->createServer('localhost:1337')->then(function (Server $server) use ($loop) {
    $server->on('connection', function(Client $client) {
        echo $client->getRemoteAddr() .' connected' . PHP_EOL;
    });
});

$loop->run();
```

Install
-------

[](#install)

The recommended way to install this library cloning this repo and installing its dependencies [through composer](http://getcomposer.org). [New to composer?](http://getcomposer.org/doc/00-intro.md)

```
$ sudo apt-get install php5-cli git curl
$ git clone https://github.com/clue/php-redis-server.git
$ cd php-redis-server/
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
```

Docker
------

[](#docker)

This project is also available as a [docker](https://www.docker.com/) image. Using the [clue/php-redis-server](https://registry.hub.docker.com/u/clue/php-redis-server/) image is as easy as running this:

```
$ docker run -d clue/php-redis-server
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~205 days

Total

3

Last Release

4271d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/776829?v=4)[Christian Lück](/maintainers/clue)[@clue](https://github.com/clue)

---

Top Contributors

[![clue](https://avatars.githubusercontent.com/u/776829?v=4)](https://github.com/clue "clue (172 commits)")[![ptarjan](https://avatars.githubusercontent.com/u/40143?v=4)](https://github.com/ptarjan "ptarjan (1 commits)")

---

Tags

asyncserverredisreact

### Embed Badge

![Health badge](/badges/clue-redis-server/health.svg)

```
[![Health](https://phpackages.com/badges/clue-redis-server/health.svg)](https://phpackages.com/packages/clue-redis-server)
```

###  Alternatives

[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)[clue/redis-react

Async Redis client implementation, built on top of ReactPHP.

28210.5M45](/packages/clue-redis-react)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)[clue/docker-react

Async, event-driven access to the Docker Engine API, built on top of ReactPHP.

113154.9k1](/packages/clue-docker-react)[react/datagram

Event-driven UDP datagram socket client and server for ReactPHP

99759.5k36](/packages/react-datagram)[clue/reactphp-eventsource

Instant real-time updates. Lightweight EventSource client receiving live messages via HTML5 Server-Sent Events (SSE). Fast stream processing built on top of ReactPHP's event-driven architecture.

5818.5k3](/packages/clue-reactphp-eventsource)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
