leocarmo / php-redis-queue
PHP Redis Queue
1.0.0
2019-07-23 22:13 UTC
Requires (Dev)
- phpunit/php-code-coverage: ^6.1
- phpunit/phpunit: ~7.0
- symfony/var-dumper: ^4.3
This package is auto-updated.
Last update: 2024-12-15 02:44:48 UTC
README
Starting with composer
composer require leocarmo/php-redis-queue
For examples, see
examples
folder on this project
The Publisher
use LeoCarmo\RedisQueue\Publisher; $redis = new Redis(); $redis->connect('localhost'); Publisher::setQueueClient('my-queue', $redis); Publisher::pushMessage('my-queue', [ 'message' => 'Hello World!' ]);
The Listener
use LeoCarmo\RedisQueue\Listener; $redis = new Redis(); $redis->connect('localhost'); Listener::setQueueClient('my-queue', $redis); Listener::restoreMessagesFromProcessingQueue('my-queue', 1); while (true) { Listener::processMessages('my-queue', 1, 1, function ($events) { dump($events); }); }
Tests soon