PHPackages                             lanfix/yii2-redis-pub-sub - 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. lanfix/yii2-redis-pub-sub

ActiveLibrary[Caching](/categories/caching)

lanfix/yii2-redis-pub-sub
=========================

Yii2 pub/sub component for Redis

0.1.3(6y ago)0309MITPHPPHP &gt;=7.0.0

Since Nov 22Pushed 6y agoCompare

[ Source](https://github.com/lanfix/yii2-redis-pub-sub)[ Packagist](https://packagist.org/packages/lanfix/yii2-redis-pub-sub)[ RSS](/packages/lanfix-yii2-redis-pub-sub/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (5)Used By (0)

yii2-redis-pub-sub
==================

[](#yii2-redis-pub-sub)

This library adds binding functions for **Redis** to publish and subscribe to channels.

How to install
--------------

[](#how-to-install)

You must do it for prepare system to work:

- Compile php with php-redis extension if you use php-fpm or install php-redis apache module in other case.
- Enable php-redis in *php.ini* `extension=redis`

Next install this library with composer

```
composer require --prefer-dist lanfix/yii2-redis-pub-sub
```

Or add this string to *composer.json*

```
"lanfix/yii2-redis-pub-sub": "*"
```

Set up
------

[](#set-up)

Firstly add to configure file `web.php` this code

```
'redisPubSub' => [
    'class' => 'lanfix\redis_pub_sub\RedisPubSub',
    'connect' => [
        'hostname' => 'localhost',
        'port' => 6379,
        'password' => ''
    ]
],
```

Usage
-----

[](#usage)

Subscribe to Redis channel

###### Warning! It function stops your application and wait messages!

[](#warning-it-function-stops-your-application-and-wait-messages)

It is desirable to run this function in parallel or in other daemon

```
Yii::$app->redisPubSub->subscribe('my-channel-name', function($message) {
    var_dump($message);
});
```

And sending message to this channel

```
Yii::$app->redisPubSub->publish('my-channel-name', 'Hello! How are you?');
```

To unsubscribe from channel use

```
Yii::$app->redisPubSub->unsubscribe('my-channel-name');
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~170 days

Total

4

Last Release

2217d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

0.1.1PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49123ae4b8a2e0e0779934e8625de2a0754fd9968d6cbfe8d319c6fc7ad700c1?d=identicon)[lanfix](/maintainers/lanfix)

---

Top Contributors

[![lanfix](https://avatars.githubusercontent.com/u/47291532?v=4)](https://github.com/lanfix "lanfix (13 commits)")[![hollisho](https://avatars.githubusercontent.com/u/13307208?v=4)](https://github.com/hollisho "hollisho (1 commits)")

---

Tags

componentphp7redisyii2yii2-extensionredisyii2subpub

### Embed Badge

![Health badge](/badges/lanfix-yii2-redis-pub-sub/health.svg)

```
[![Health](https://phpackages.com/badges/lanfix-yii2-redis-pub-sub/health.svg)](https://phpackages.com/packages/lanfix-yii2-redis-pub-sub)
```

###  Alternatives

[bazilio/yii2-async

Provides translucent api for moving large tasks out of request context

6248.8k2](/packages/bazilio-yii2-async)

PHPackages © 2026

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