jwage/phpamqplib-messenger
Composer 安装命令:
composer require jwage/phpamqplib-messenger
包简介
Symfony messenger transport for the php-amqplib/php-amqplib library.
关键字:
README 文档
README
This bundle adds support for php-amqplib/php-amqplib to Symfony Messenger, providing an alternative way to connect to RabbitMQ using a pure PHP library instead of the php-amqp C extension.
Installation
composer require jwage/phpamqplib-messenger
Make sure the bundled is enabled in config/bundles.php:
return [ // ... Jwage\PhpAmqpLibMessengerBundle\PhpAmqpLibMessengerBundle::class => ['all' => true], ];
The minimum configuration required is the transports name and the DSN.
# config/packages/messenger.yaml framework: messenger: transports: orders: dsn: 'phpamqplib://guest:guest@localhost:5672/myvhost/orders'
The configuration above will create an exchange named orders and bind a queue named orders to it within the vhost myvhost.
Roadmap
The objective and future roadmap for this bundle is to achieve version 1.0 as a third-party Symfony bundle first, and then subsequently integrate it into the Symfony core for Symfony 7.4 LTS, as symfony/phpamqplib-messenger, providing an alternative to symfony/amqp-messenger.
Documentation
For detailed documentation, including advanced configuration options, features, and usage examples, please see the documentation.
Why use this bundle?
There are several reasons why you might prefer to use the php-amqplib/php-amqplib library over the php-amqp C extension for connecting to RabbitMQ in Symfony Messenger:
-
Asynchronous Consumers: The
php-amqpliblibrary properly implements asynchronous consumers, which allows for more efficient message handling. This is particularly useful for advanced use cases where you need to handle a large number of messages concurrently. -
Active Maintenance: Both
php-amqplibandphp-amqpare actively maintained by VMware. However,php-amqplibis often preferred for its flexibility and ease of use in PHP applications. -
PHP Version Compatibility: Using
php-amqplibmakes upgrading PHP versions easier, as it does not rely on a C extension that may have compatibility issues with newer PHP versions. -
Efficient Message Streaming: The
php-amqpliblibrary allows for proper streaming of messages from the server, avoiding the inefficiencies of constant polling withget(). This means that you can maintain an open stream connection and control how long to wait for messages, which is not possible with thephp-amqpextension. -
Safe Worker Shutdown: With
php-amqplib, you can safely stop your workers usingpcntlsignals, ensuring that your handlers do not get shut down mid-message handling. This is a significant advantage over thephp-amqpextension, where theconsume()method does not work as expected, leading to potential issues with worker shutdown.
In summary, php-amqplib provides a more robust and flexible solution for connecting to RabbitMQ in Symfony Messenger, making it the preferred choice for many developers.
Message Reliability
This bundle prioritizes message reliability over raw performance. By default, confirms are enabled to ensure that messages are acknowledged by the server. In the event of a connection exception, publishes are retried if there is uncertainty about whether a message was received by the server. This approach ensures that messages are not lost, but it also means that a message could potentially be published twice. Therefore, it is crucial to ensure that your message handlers are 100% idempotent to handle such scenarios gracefully.
Acknowledgements
We would like to express our sincere gratitude to @videlalvaro, the author of the php-amqplib library, for his invaluable contributions to the development of this project. We also acknowledge Microsoft for supporting his efforts, as he utilized company time to help make this Symfony bundle a robust and reliable solution for connecting to RabbitMQ in Symfony applications.
License
This bundle is licensed under the MIT License. See the LICENSE file for details.
jwage/phpamqplib-messenger 适用场景与选型建议
jwage/phpamqplib-messenger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 216.84k 次下载、GitHub Stars 达 87, 最近一次更新时间为 2025 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「Messenger」 「enqueue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jwage/phpamqplib-messenger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jwage/phpamqplib-messenger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jwage/phpamqplib-messenger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Swiftmailer Spool using the Enqueue message queue
The bundle for easy using json-rpc api on your project
Enables the creation of cron-jobs tasks to be consumed by symfony/messenger
Messenger functionality for Laravel 5.2.
统计信息
- 总下载量: 216.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 87
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-12