PHPackages                             sadistdimaz/redis-react - 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. [Database &amp; ORM](/categories/database)
4. /
5. sadistdimaz/redis-react

ActiveLibrary[Database &amp; ORM](/categories/database)

sadistdimaz/redis-react
=======================

Async Redis client implementation, built on top of ReactPHP.

v2.6.1(3y ago)051MITPHPPHP &gt;=5.3

Since May 31Pushed 3y agoCompare

[ Source](https://github.com/sadistdimaz/reactphp-redis)[ Packagist](https://packagist.org/packages/sadistdimaz/redis-react)[ Docs](https://github.com/clue/reactphp-redis)[ Fund](https://clue.engineering/support)[ GitHub Sponsors](https://github.com/clue)[ RSS](/packages/sadistdimaz-redis-react/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (18)Used By (0)

clue/reactphp-redis
===================

[](#cluereactphp-redis)

[![CI status](https://github.com/clue/reactphp-redis/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-redis/actions)[![installs on Packagist](https://camo.githubusercontent.com/372f0dee4c2d1c5b28c7d5873a702702832d3e283744f9f90b1ae9d0d881fd8a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c75652f72656469732d72656163743f636f6c6f723d626c7565266c6162656c3d696e7374616c6c732532306f6e2532305061636b6167697374)](https://packagist.org/packages/clue/redis-react)

Async [Redis](https://redis.io/) client implementation, built on top of [ReactPHP](https://reactphp.org/).

> **Development version:** This branch contains the code for the upcoming 3.0 release. For the code of the current stable 2.x release, check out the [`2.x` branch](https://github.com/clue/reactphp-redis/tree/2.x).
>
> The upcoming 3.0 release will be the way forward for this package. However, we will still actively support 2.x for those not yet on the latest version. See also [installation instructions](#install) for more details.

[Redis](https://redis.io/) is an open source, advanced, in-memory key-value database. It offers a set of simple, atomic operations in order to work with its primitive data types. Its lightweight design and fast operation makes it an ideal candidate for modern application stacks. This library provides you a simple API to work with your Redis database from within PHP. It enables you to set and query its data or use its PubSub topics to react to incoming events.

- **Async execution of Commands** - Send any number of commands to Redis in parallel (automatic pipeline) and process their responses as soon as results come in. The Promise-based design provides a *sane* interface to working with async responses.
- **Event-driven core** - Register your event handler callbacks to react to incoming events, such as an incoming PubSub message event.
- **Lightweight, SOLID design** - Provides a thin abstraction that is [*just good enough*](https://en.wikipedia.org/wiki/Principle_of_good_enough)and does not get in your way. Future or custom commands and events require no changes to be supported.
- **Good test coverage** - Comes with an automated tests suite and is regularly tested against versions as old as Redis v2.6 and newer.

**Table of Contents**

- [Support us](#support-us)
- [Quickstart example](#quickstart-example)
- [Usage](#usage)
    - [Commands](#commands)
    - [Promises](#promises)
    - [PubSub](#pubsub)
- [API](#api)
    - [RedisClient](#redisclient)
        - [\_\_construct()](#__construct)
        - [\_\_call()](#__call)
        - [end()](#end)
        - [close()](#close)
        - [error event](#error-event)
        - [close event](#close-event)
- [Install](#install)
- [Tests](#tests)
- [License](#license)

Support us
----------

[](#support-us)

We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by [becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue)for details.

Let's take these projects to the next level together! 🚀

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

[](#quickstart-example)

Once [installed](#install), you can use the following code to connect to your local Redis server and send some requests:

```
