PHP code example of kain / rabbitmq-management-api
1. Go to this page and download the library: Download kain/rabbitmq-management-api 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/ */
kain / rabbitmq-management-api example snippets
use RabbitMQ\API\RabbitMQ;
use GuzzleHttp\Client;
$api = RabbitMQ::create(
'http://localhost:15672/api/',
'guest',
'guest'
);
// Can also be like this
$client = new Client([
'base_uri' => 'https://myrabbitproxy.com/api/',
'auth' => ['guest', 'guest'],
'timeout' => 30.0,
'debug' => true,
'verify' => false,
'version' => 2.0
]);
$this->api = new RabbitMQ($client);
use RabbitMQ\API\RabbitMQ;
$api = RabbitMQ::create(
'http://localhost:15672/api/',
'guest',
'guest'
);
$response = $api->overview();
// Whether the response failed
$response->isError();
// Respond to the prompt message
$response->getMsg();
// Response return data
$response->getData();
// Returns an array of responses
$result = $response->result();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.