Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RioRizkyRainey/pubsub-redis-php
Pub/Sub Redis for php
https://github.com/RioRizkyRainey/pubsub-redis-php
Last synced: about 1 month ago
JSON representation
Pub/Sub Redis for php
- Host: GitHub
- URL: https://github.com/RioRizkyRainey/pubsub-redis-php
- Owner: RioRizkyRainey
- License: mit
- Created: 2020-06-18T04:58:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-19T08:25:56.000Z (over 4 years ago)
- Last Synced: 2024-08-02T20:46:37.368Z (4 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-indo-projects - Pub/Sub Redis for PHP - Implementasi Publisher-Subscriber Pattern pada PHP menggunakan Redis. (PHP)
- awesome-indonesia-repo - Pub/Sub Redis for PHP - Implementasi Publisher-Subscriber Pattern pada PHP menggunakan Redis. (PHP)
README
# Pub/Sub Redis for PHP
Pub/Sub Redis for php
![PHP Composer](https://github.com/RioRizkyRainey/pubsub-redis-php/workflows/PHP%20Composer/badge.svg)
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
### Prerequisites
Before you go make sure you already install Redis.
### Installing
Install with composer
```
composer require riorizkyrainey/pubsub-redis-php
```## Usage - Subscribe
```
$client = new Predis\Client([
'scheme' => 'tcp',
'host' => 'redis',
'port' => 6379,
'database' => 0,
'read_write_timeout' => 0,
]);$redisSubscribeAdapter = new \RioRizkyRainey\PubsubRedis\RedisSubscribeAdapter();
$redisSubscribeAdapter->setClient($client)
->setChannel('channel')
->subscribe(function ($message) {
printf($message . PHP_EOL);
});```
## Usage - Publisher
```
$client = new Predis\Client([
'scheme' => 'tcp',
'host' => 'redis',
'port' => 6379,
'database' => 0,
'read_write_timeout' => 0,
]);$redisPublishAdapter = new \RioRizkyRainey\PubsubRedis\RedisPublishAdapter();
$redisPublishAdapter->setClient($client)
->setChannel('channel');$redisPublishAdapter->publishMessage('Hi, How do you do?');
$redisPublishAdapter->publishBulkMessage(['Nice to meet you', 'Where are you going?']);
$redisPublishAdapter->publishMessage('I don\'t feel good mr stark');```
## Built With
* [Predis](https://github.com/nrk/predis) - Flexible and feature-complete Redis client for PHP and HHVM
* [PHPUnit](https://github.com/sebastianbergmann/phpunit) - The PHP Unit Testing framework.
* [Mockery](https://github.com/mockery/mockery) - Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit## Contributing
Please read [CONTRIBUTING.md](https://github.com/RioRizkyRainey/pubsub-redis-php/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/RioRizkyRainey/pubsub-redis-php/tags).
## Authors
* **Rio Rizky Rainey** - *Initial work* - (https://github.com/RioRizkyRainey)
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Inspired from [Superbalist](https://github.com/Superbalist)