PHPackages                             jdwx/redis-pubsub - 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. jdwx/redis-pubsub

ActiveLibrary[Caching](/categories/caching)

jdwx/redis-pubsub
=================

v0.2.0(3y ago)111PHPPHP ^8.0

Since Apr 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jdwx/php-redis-pubsub)[ Packagist](https://packagist.org/packages/jdwx/redis-pubsub)[ RSS](/packages/jdwx-redis-pubsub/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

php-redis-pubsub
================

[](#php-redis-pubsub)

This is a lightweight PHP client for asynchronous Redis pub/sub functionality with TLS and authentication. It uses PHP's inbuilt stream functions and has no external dependencies.

The target use case is for a long-running process that is subscribed to one or more Redis channels and needs to process incoming messages in a timely fashion, but also has other stuff to do.

It also supports a simple publishing interface. This is suitable for apps that need to publish messages to a Redis channel, but don't otherwise interact with Redis.

This is *not* intended to be a full-featured Redis client. That space is extremely well covered by other extensions and packages.

This package requires PHP 8.0 or later.

Installation
------------

[](#installation)

Via composer:

```
composer require jdwx/redis-pubsub
```

Usage
-----

[](#usage)

### Publisher:

[](#publisher)

```
use JDWX\RedisPubSub\RedisPubSub;

# By default, a connection is made to localhost:6379 without TLS.
$rps = new RedisPubSub();
$rps->publish( 'test', 'Hello, world!' );
```

### Subscriber:

[](#subscriber)

```
use JDWX\RedisPubSub\RedisPubSub;

# TLS is enabled by providing the paths to the client certificate and key, and,
# optionally, the CA certificate if the server should be verified.
$rps = new RedisPubSub( 'localhost', 6379, './client.crt', './client.key', './ca.crt' );

# Perform authentication.
$rps->auth( 'password' );

# Subscribe to a channel.
$rps->subscribe( 'test' );

# This will block until a message is received.
$msg = $rps->recv();

# This will not block if there are no pending messages.
$msg = $rps->tryRecv();

# This will wait for up to 5 seconds for a message to return.
$msg = $rps->tryRecv( 5.0 );

# This will wait for a message for up to 5 seconds without returning it.
$msg = $rps->tryWait( 5.0 );

# A callback function.
function MyCallback( array $msg ) : void {
    var_dump( $msg );
}

# This will pass all messages currently in the queue to the callback function,
# one at a time.
$rps->recvAll( 'MyCallback' );

# This will wait 5 seconds for messages to arrive, passing them one at a time
# to the callback function.
$rps->recvAllWait( 5.0, 'MyCallback' );
```

License
-------

[](#license)

This library is licensed under the BSD 2-clause license. See the [LICENSE](LICENSE) file for details.

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1233d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71b4b976170f89eac19be48c7381a27c49ed8c9cb5e8e6ff05a2ad7583efa13?d=identicon)[jdwx](/maintainers/jdwx)

---

Top Contributors

[![jdwx](https://avatars.githubusercontent.com/u/2722779?v=4)](https://github.com/jdwx "jdwx (5 commits)")

### Embed Badge

![Health badge](/badges/jdwx-redis-pubsub/health.svg)

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

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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