PHP code example of avto-dev / rabbitmq-api-client

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

    

avto-dev / rabbitmq-api-client example snippets




use AvtoDev\RabbitMqApiClient\Client;
use AvtoDev\RabbitMqApiClient\ConnectionSettings;

$client = new Client(new ConnectionSettings('http://127.0.0.1:15672', 'guest', 'guest'));

// And after that you can execute API commands, for example:

$client::version();     // Client version, like `1.0.0`
$client->healthcheck(); // `true` or `false`
$client->queueInfo('some-queue-name'); // Object with information about queue



namespace App\Console\Commands;

use AvtoDev\RabbitMqApiClient\ClientInterface;

class SomeCommand extends \Illuminate\Console\Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'some:command';

    /**
     * Execute the console command.
     *
     * @param ClientInterface $client
     *
     * @return void
     */
    public function handle(ClientInterface $client): void
    {
        $client->healthcheck(); // `true` or `false`
    }
}
bash
$ php artisan vendor:publish --provider="AvtoDev\\RabbitMqApiClient\\Frameworks\\Illuminate\\LaravelServiceProvider"