richardfullmer/rabbitmq-management-api

面向对象的RabbitMQ Management HTTP Api包装器

2.1.0 2020-12-01 17:05 UTC

This package is auto-updated.

Last update: 2024-08-29 03:26:05 UTC


README

PHP 5.3中简单的面向对象包装器,用于RabbitMQ Management HTTP Api

使用PHP-HTTP进行请求。

安装

可以通过composer通过以下方式安装

$ composer require richardfullmer/rabbitmq-management-api

此外,您还需要一个httplug兼容的客户端

例如,使用guzzle6适配器

$ composer require php-http/guzzle6-adapter

基本用法

<?php

use RabbitMq\ManagementApi\Client;

require_once __DIR__ . '/../vendor/autoload.php';

$client = new Client();
$queue = $client->queues()->get('/', 'sample-messages-queue');
$response = $client->exchanges()->publish('/', 'sample-messages', array(
    'properties' => array(),
    'routing_key' => '',
    'payload' => 'This is a test',
    'payload_encoding' => 'string'
));

if ($response['routed']) {
    print 'Message delivered';
}

许可证

php-rabbitmq-management-api采用MIT许可证 - 详细信息请参阅LICENSE文件

致谢

结构来自KnpLabs php-github-api

Rabbit的优秀消息队列