lefuturiste / rabbitmq-consumer
The simplest way to consume RabbitMQ messages
v1.3
2018-08-31 20:58 UTC
Requires
- php-amqplib/php-amqplib: ^2.7
Requires (Dev)
- phpunit/phpunit: ^7.3
This package is auto-updated.
Last update: 2024-12-20 08:35:38 UTC
README
The simplest way to consume RabbitMQ messages.
Installation
Using composer dependencies manager:
composer require lefuturiste/rabbitmq-consumer
Require
- PHP >= 7.1
Usage
In your PHP deamon script:
require 'vendor/autoload.php';
$connection = new \PhpAmqpLib\Connection\AMQPStreamConnection("localhost", 5672, 'username', 'password', 'virtualhost');
$client = new \Lefuturiste\RabbitMQConsumer\Client($connection);
$client->addListener('my_event', function(array $message, $rootValue){
var_dump($message);
echo "\n";
});
$client->listen();
Tests
phpunit tests