承接 ipedis/rabbit-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ipedis/rabbit-client

最新稳定版本:2.1.0

Composer 安装命令:

composer require ipedis/rabbit-client

包简介

Event and Order client library

README 文档

README

CI Latest Version on Packagist PHP Version License

RabbitMQ client library for PHP supporting event publishing, order request/reply, and workflow orchestration with progress tracking. Built on the AMQP extension.

Installation

composer require ipedis/rabbit-client

Requires the ext-amqp PHP extension.

Quick Start

Publish an event

use Ipedis\Rabbit\Event\EventDispatcher;

class MyDispatcher
{
    use EventDispatcher;

    protected function getSignatureKey(): string
    {
        return 'your-secret';
    }
}

$dispatcher = new MyDispatcher(/* connection config */);
$payload = EventMessagePayload::build('v1.admin.publication.was-exported', [
    'publication' => ['sid' => 42],
]);
$dispatcher->dispatch($payload);

Submit an order and wait for reply

use Ipedis\Rabbit\Order\Manager;

class MyManager
{
    use Manager;
}

$manager = new MyManager(/* connection config */);
$payload = OrderMessagePayload::build('v1.admin.publication.generate', ['data' => '...']);

$manager->publish($payload, function (ReplyMessagePayload $reply) {
    echo $reply->getBody(); // Worker result
});

$manager->run(); // Blocks until reply received

Key Concepts

Concept Description
Event Fire-and-forget pub/sub message via EventDispatcher / EventListener
Order Request/reply pattern via Manager (publisher) / Worker (consumer)
Workflow Sequential groups of orders with progress tracking and retry logic
Channel Standardized naming: v<version>.<service>.<aggregate>.<action>
Message Payload Typed payloads with auto-generated UUID, timestamp, and timezone

Channel Naming

All channels follow the pattern v<version>.<service>.<aggregate>.<action>:

v1.admin.publication.generate
v1.admin.publication.was-exported

Workflow Example

use Ipedis\Rabbit\Workflow\Workflow;
use Ipedis\Rabbit\Workflow\Group;

$workflow = new Workflow(function (Group $group) {
    $group->add(new Task('step-1', $payload1));
    $group->add(new Task('step-2', $payload2));
})
->then(function (Group $group) {
    $group->add(new Task('step-3', $payload3)); // Runs after group 1 completes
});

$progress = $workflow->getProgressBag();
$progress->getPercentage()->getCompleted(); // 0.0 - 100.0
$progress->getStatus();                      // pending|running|success|failed

Dependencies

This library depends on ipedis/http-signature for signed HTTP recovery endpoints.

Compatibility

PHP Status
8.2
8.3
8.4
8.5

Required extensions: amqp, json

Local Development

Requires Docker.

make up        # Start container
make install   # Install dependencies
make qa        # Run full QA suite (rector + pint + phpstan + tests)

Available targets:

Command Description
make up Start container
make down Stop container
make install Install Composer dependencies
make update Update Composer dependencies
make test Run tests
make phpstan Run static analysis (level max)
make pint Fix code style (PSR-12)
make rector Run automated refactoring
make qa Run all checks
make shell Open container shell

Disclaimer

This package is maintained by Ipedis. It is provided as-is under the terms of its license.

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固