Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scientanl/php-rsmq-client
PHP rsmq client
https://github.com/scientanl/php-rsmq-client
message-queue php redis rsmq
Last synced: 10 days ago
JSON representation
PHP rsmq client
- Host: GitHub
- URL: https://github.com/scientanl/php-rsmq-client
- Owner: ScientaNL
- License: mit
- Created: 2019-09-16T14:09:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-01T14:49:17.000Z (about 4 years ago)
- Last Synced: 2024-12-30T01:24:05.533Z (12 days ago)
- Topics: message-queue, php, redis, rsmq
- Language: PHP
- Size: 12.7 KB
- Stars: 4
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/scienta/php-rsmq-client/v/stable?format=flat)](https://packagist.org/packages/scienta/php-rsmq-client)
[![Total Downloads](https://poser.pugx.org/syslogic/php-rsmq-client/downloads?format=flat)](https://packagist.org/packages/syslogic/php-rsmq-client/stats)
[![License](https://poser.pugx.org/scienta/php-rsmq-client/license)](https://packagist.org/packages/scienta/php-rsmq-client)# php-rsmq-client
A library for queueing [RSMQ](https://www.npmjs.com/package/rsmq) messages in [Redis](https://redis.io/).### TL;DR
A php implementation of the enqueue-code from [RSMQ](https://www.npmjs.com/package/rsmq) for adding messages to the queue.
Supports [realtime](https://www.npmjs.com/package/rsmq#realtime) PUBLISH of new messages.Installation
------------
The recommended way to install php-rsmq-client is through [Composer](https://getcomposer.org/).
Add the following dependency to your composer.json
```json
{
"require": {
"scienta/php-rsmq-client": "~1.0"
}
}
```
Alternatively, you can download the [source code as a file](https://github.com/ScientaNL/php-rsqm-client/releases) and extract it.Usage
-----Configuration for queues and messages can be more elaborate than specified below, all [RSMQ](https://www.npmjs.com/package/rsmq) options are supported.
The library makes use of a Redis adapter make the usage of other php redis clients possible.
Default (used in this example) is the [phpredis](https://github.com/phpredis/phpredis) C extension.### Creating a basic queue
```php
use Scienta\RSMQClient\Config;
use Scienta\RSMQClient\Message;
use Scienta\RSMQClient\Queue;
use Scienta\RSMQClient\Redis\RedisAdapter;//Create a redis connection
$redis = new \Redis();
$redis->connect('127.0.0.1', '6379');//Configure and create/sync a queue
$config = new Config('myqueue');
$redisAdapter = new RedisAdapter($redis);
$queue = new Queue($config, $redisAdapter);//Create a message
$message = new Message('Hello World');//Send the message
$sentId = $queue->sendMessage($message);
```