lefuturiste/rabbitmq-consumer

The simplest way to consume RabbitMQ messages

v1.3 2018-08-31 20:58 UTC

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

See also