PHP code example of lefuturiste / rabbitmq-consumer

1. Go to this page and download the library: Download lefuturiste/rabbitmq-consumer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lefuturiste / rabbitmq-consumer example snippets




$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();