kain/rabbitmq-management-api

This package is abandoned and no longer maintained. No replacement package was suggested.

RabbitMQ Management HTTP API

1.1 2020-04-26 08:44 UTC

This package is auto-updated.

Last update: 2024-10-05 22:40:55 UTC


README

RabbitMQ Management HTTP API

Packagist Version Travis (.org) Coveralls github PHP from Packagist Packagist License

Setup

composer require kain/rabbitmq-management-api

Usage

Create an RabbitMQ Management HTTP API client

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

Get overview

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

Use method is consistent with the document http://localhost:15672/api/index.html