PHPackages                             yangweijie/es-bunny - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yangweijie/es-bunny

ActiveLibrary

yangweijie/es-bunny
===================

v0.7.0(7mo ago)04MITPHPPHP &gt;=7.4

Since Oct 11Pushed 7mo agoCompare

[ Source](https://github.com/yangweijie/es-bunny)[ Packagist](https://packagist.org/packages/yangweijie/es-bunny)[ RSS](/packages/yangweijie-es-bunny/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

ES-Bunny
========

[](#es-bunny)

ES-Bunny是一个适用于EasySwoole的AMQP/RabbitMQ客户端库，基于PHP实现，支持同步和异步（基于Swoole协程）两种使用方式。

特性
--

[](#特性)

- 同步客户端：适用于简单的应用场景
- 异步客户端：基于Swoole协程，适用于需要高并发处理能力的场景
- 完全兼容AMQP 0-9-1协议
- 支持心跳检测，确保连接稳定性
- 易于使用的API，遵循AMQP类/方法命名约定

安装
--

[](#安装)

```
composer require yangweijie/es-bunny
```

环境要求
----

[](#环境要求)

- PHP &gt;= 7.4
- Swoole扩展（可选，用于异步客户端）
- EasySwoole框架（可选，用于异步客户端）

使用方法
----

[](#使用方法)

### 同步客户端

[](#同步客户端)

```
use Yangweijie\EsBunny\SynchronousClient;

$client = new SynchronousClient([
    'host' => '127.0.0.1',
    'port' => 5672,
    'vhost' => '/',
    'user' => 'guest',
    'password' => 'guest',
]);

try {
    $client->connect();
    $channel = $client->channel();
    $channel->queueDeclare('test-queue', false, true, false, false);

    // 发布消息
    $channel->publish('Hello World!', [], '', 'test-queue');

    // 消费消息
    $message = $channel->get('test-queue');
    if ($message) {
        echo "Received: " . $message->content . "\n";
        $channel->ack($message);
    }

    $client->disconnect();
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
```

### 异步客户端（基于Swoole协程）

[](#异步客户端基于swoole协程)

```
use Yangweijie\EsBunny\EasySwooleClient;

$client = new EasySwooleClient([
    'host' => '127.0.0.1',
    'port' => 5672,
    'vhost' => '/',
    'user' => 'guest',
    'password' => 'guest',
]);

try {
    $client->connect();
    $channel = $client->channel();
    $channel->queueDeclare('test-queue', false, true, false, false);

    // 发布消息
    $channel->publish('Hello World!', [], '', 'test-queue');

    // 消费消息
    $message = $channel->get('test-queue');
    if ($message) {
        echo "Received: " . $message->content . "\n";
        $channel->ack($message);
    }

    $client->disconnect();
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
```

运行示例
----

[](#运行示例)

```
php example/basic.php
```

测试
--

[](#测试)

```
phpunit
```

许可证
---

[](#许可证)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance65

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

211d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0b5f090a9bb92727e9c2e8281d05c2da5f2f9bf66cf1811714a9ffc0e383325?d=identicon)[yangweijie](/maintainers/yangweijie)

---

Top Contributors

[![yangweijie](https://avatars.githubusercontent.com/u/1614114?v=4)](https://github.com/yangweijie "yangweijie (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yangweijie-es-bunny/health.svg)

```
[![Health](https://phpackages.com/badges/yangweijie-es-bunny/health.svg)](https://phpackages.com/packages/yangweijie-es-bunny)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
