Skip to content

Commit d3d85b0

Browse files
authored
Update README.md
1 parent b5c92f0 commit d3d85b0

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,57 @@
1+
[![Latest Stable Version](https://poser.pugx.org/scienta/php-rsmq-client/v/stable?format=flat)](https://packagist.org/packages/scienta/php-rsmq-client)
2+
[![Total Downloads](https://poser.pugx.org/syslogic/php-rsmq-client/downloads?format=flat)](https://packagist.org/packages/syslogic/php-rsmq-client/stats)
3+
[![License](https://poser.pugx.org/scienta/php-rsmq-client/license)](https://packagist.org/packages/scienta/php-rsmq-client)
4+
5+
16
# php-rsmq-client
2-
PHP rsmq client
7+
A library for queueing [RSMQ](https://www.npmjs.com/package/rsmq) messages in [Redis](https://redis.io/).
8+
9+
10+
### TL;DR
11+
A php implementation of the enqueue-code from [RSMQ](https://www.npmjs.com/package/rsmq) for adding messages to the queue.
12+
Supports [realtime](https://www.npmjs.com/package/rsmq#realtime) PUBLISH of new messages.
13+
14+
15+
Installation
16+
------------
17+
The recommended way to install php-rsmq-client is through [Composer](https://getcomposer.org/).
18+
Add the following dependency to your composer.json
19+
```json
20+
{
21+
"require": {
22+
"scienta/php-rsmq-client": "~1.0"
23+
}
24+
}
25+
```
26+
Alternatively, you can download the [source code as a file](https://github.com/ScientaNL/php-rsqm-client/releases) and extract it.
27+
28+
29+
Usage
30+
-----
31+
32+
Configuration for queues and messages can be more elaborate than specified below, all [RSMQ](https://www.npmjs.com/package/rsmq) options are supported.
33+
The library makes use of a Redis adapter make the usage of other php redis clients possible.
34+
Default (used in this example) is the [phpredis](https://github.com/phpredis/phpredis) C extension.
35+
36+
### Creating a basic queue
37+
```php
38+
use Scienta\RSMQClient\Config;
39+
use Scienta\RSMQClient\Message;
40+
use Scienta\RSMQClient\Queue;
41+
use Scienta\RSMQClient\Redis\RedisAdapter;
42+
43+
//Create a redis connection
44+
$redis = new \Redis();
45+
$redis->connect('127.0.0.1', '6379');
46+
47+
//Configure and create/sync a queue
48+
$config = new Config('myqueue');
49+
$redisAdapter = new RedisAdapter($redis);
50+
$queue = new Queue($config, $redisAdapter);
51+
52+
//Create a message
53+
$message = new Message('Hello World');
54+
55+
//Send the message
56+
$sentId = $queue->sendMessage($message);
57+
```

0 commit comments

Comments
 (0)