etopian / rabbitmq-management-api
RabbitMQ 管理HTTP Api的对象封装
2.2.1
2021-10-10 00:35 UTC
Requires
- php: >=7.3
- php-http/client-common: ^2.2.1
- php-http/client-implementation: >=1.0
- php-http/discovery: ^1.0
- php-http/guzzle7-adapter: ^1.0
- php-http/httplug: ^2.0
- php-http/message-factory: ^1.0
- psr/http-message: >=1.0
README
这是一个简单的对象封装,用于PHP 7.1+版本的RabbitMQ 管理HTTP Api
使用PHP-HTTP进行请求。
安装
通过composer安装
$ composer require etopian/rabbitmq-management-api
此外,您需要一个httplug 兼容的客户端。
例如,使用Guzzle 7适配器
$ composer require php-http/guzzle7-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文件
致谢
Rabbit的优秀消息队列