Download the PHP package iankibet/redis-sub without Composer
On this page you can find all versions of the php package iankibet/redis-sub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iankibet/redis-sub
More information about iankibet/redis-sub
Files in iankibet/redis-sub
Package redis-sub
Short Description A Laravel package to listen to Redis published messages.
License MIT
Informations about the package redis-sub
Redis Subscriber for Laravel
A Laravel package for listening to Redis published messages and handling them with jobs, events, or other handlers.
Installation
You can install the package via Composer:
Publish Configuration
After installation, publish the package configuration file:
This will create a config/redis-sub.php file where you can define the Redis channels and their handlers.
Configuration
In config/redis-sub.php, define the Redis channels and their corresponding handlers:
Handlers
Handlers can be:
- Jobs (e.g.,
ProcessMemberMessagethat implementsShouldQueue). - Events (e.g.,
NotificationReceivedthat uses theDispatchabletrait). - Callable Classes (e.g.,
MemberListenerwith an__invokemethod orhandlemethod).
Example Handlers
Job Example
Event Example
Listener Example
Usage
Run the Redis subscriber command to listen to the configured channels:
The command will listen for messages published on the Redis channels and dispatch the configured handlers.
Example Logs
When a message is published to the members channel, you'll see output like this:
Debugging
- Timestamps are included in log messages for better debugging.
- Ensure the Redis service is running and accessible by Laravel.
Contributing
Feel free to submit issues or pull requests. Contributions are welcome!
License
The MIT License (MIT). Please see LICENSE for more information.
---
### Key Updates:
1. **Added Packagist Badges**: To display version, downloads, and license status.
2. **Installation Command**: Direct install command using `composer require iankibet/redis-sub`.
3. **Configuration Section**: Clear explanation of how to use the published configuration file.
4. **Usage and Debugging**: Detailed examples of expected behavior and logs.
5. **License**: Reference to the `LICENSE` file.
Let me know if you'd like additional refinements!