This library is a pure PHP implementation of the AMQP 0-9-1 protocol. It's been tested against RabbitMQ.
The library was used for the PHP examples of RabbitMQ in Action and the official RabbitMQ tutorials.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Thanks to videlalvaro and postalservice14 for creating php-amqplib.
The package is now maintained by Ramūnas Dronga, Luke Bakken and several VMware engineers working on RabbitMQ.
Starting with version 2.0 this library uses AMQP 0.9.1 by default and thus requires RabbitMQ 2.0 or later version.
Usually server upgrades do not require any application code changes since
the protocol changes very infrequently but please conduct your own testing before upgrading.
Since the library uses AMQP 0.9.1 we added support for the following RabbitMQ extensions:
- Exchange to Exchange Bindings
- Basic Nack
- Publisher Confirms
- Consumer Cancel Notify
Extensions that modify existing methods like alternate exchanges are also supported.
-
enqueue/amqp-lib is a amqp interop compatible wrapper.
-
AMQProxy is a proxy library with connection and channel pooling/reusing. This allows for lower connection and channel churn when using php-amqplib, leading to less CPU usage of RabbitMQ.
Ensure you have composer installed, then run the following command:
$ composer require php-amqplib/php-amqplibThat will fetch the library and its dependencies inside your vendor folder. Then you can add the following to your .php files in order to use the library
require_once __DIR__.'/vendor/autoload.php';Then you need to use the relevant classes, for example:
use PhpAmqpLib\