PHPackages                             iankibet/redis-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. [HTTP &amp; Networking](/categories/http)
4. /
5. iankibet/redis-sub

ActiveLibrary[HTTP &amp; Networking](/categories/http)

iankibet/redis-sub
==================

A Laravel package to listen to Redis published messages.

1.0.8(1y ago)0558MITPHP

Since Nov 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/iankibet/redis-sub)[ Packagist](https://packagist.org/packages/iankibet/redis-sub)[ RSS](/packages/iankibet-redis-sub/feed)WikiDiscussions main Synced 1mo ago

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

Redis Subscriber for Laravel
============================

[](#redis-subscriber-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/afd59dedbef749662e066959e3e0cde748bd54f40bfc0ad9e3a2572c459eebfb/68747470733a2f2f706f7365722e707567782e6f72672f69616e6b696265742f72656469732d7375622f762f737461626c65)](https://packagist.org/packages/iankibet/redis-sub)[![Total Downloads](https://camo.githubusercontent.com/5775aacd84206e6fb36817b11eaca39db47e11edbe1a75ae0022175554206311/68747470733a2f2f706f7365722e707567782e6f72672f69616e6b696265742f72656469732d7375622f646f776e6c6f616473)](https://packagist.org/packages/iankibet/redis-sub)[![License](https://camo.githubusercontent.com/3cb93b005cbe469347721e2ae3909c7931274b23833dc826dc7a6c078caa9037/68747470733a2f2f706f7365722e707567782e6f72672f69616e6b696265742f72656469732d7375622f6c6963656e7365)](https://packagist.org/packages/iankibet/redis-sub)

A Laravel package for listening to Redis published messages and handling them with jobs, events, or other handlers.

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

[](#installation)

You can install the package via Composer:

```
composer require iankibet/redis-sub
```

### Publish Configuration

[](#publish-configuration)

After installation, publish the package configuration file:

```
php artisan vendor:publish --tag=redis-sub
```

This will create a `config/redis-sub.php` file where you can define the Redis channels and their handlers.

Configuration
-------------

[](#configuration)

In `config/redis-sub.php`, define the Redis channels and their corresponding handlers:

```
return [
    'channels' => [
        'members' => [
            \App\Jobs\ProcessMemberMessage::class,
            \App\Listeners\MemberListener::class,
        ],
        'notifications' => [
            \App\Events\NotificationReceived::class,
        ],
    ],
];
```

### Handlers

[](#handlers)

Handlers can be:

- **Jobs** (e.g., `ProcessMemberMessage` that implements `ShouldQueue`).
- **Events** (e.g., `NotificationReceived` that uses the `Dispatchable` trait).
- **Callable Classes** (e.g., `MemberListener` with an `__invoke` method or `handle` method).

### Example Handlers

[](#example-handlers)

#### Job Example

[](#job-example)

```
