PHP code example of phuongna / rabbitmq

1. Go to this page and download the library: Download phuongna/rabbitmq 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/ */

    

phuongna / rabbitmq example snippets

bash
php artisan vendor:publish --provider="phuongna\rabbitmq\ServiceProvider"

$this->rabbit = app('rabbitmq.queue')->connection('rabbitmq');
RabbitMQQueue::declareRPCServer($this->rabbit, xxx, function ($request) {
    $this->rabbit->replyTo($request, dosomething($request));
});

$this->rabbit = app('rabbitmq.queue')->connection('rabbitmq');
$stringInput = json_encode(array);
RabbitMQQueue::declareRPCClient($this->rabbit, xxx, $stringInput);