Home » Php » Best PHP client library for accessing RabbitMQ (AMQP)?

Best PHP client library for accessing RabbitMQ (AMQP)?

Posted by: admin April 23, 2020 Leave a comment


There is a list of PHP clients on the RabbitMQ site. I’m asking this question in hopes that people who have used any of these can share their experiences here. E.g.

  • Did you have any trouble installing?
  • Is it stable?
  • Were there any performance issues?
  • How is the documentation / support?

Even if you’ve just used one of these libraries, please share your experiences.

For reference, here are some of the clients listed:

P.S. I know that “Best …” is “subjective”, but the point of this question is to collect experiences and help people make an informed decision about these AMQP libraries. Please don’t knee-jerk close this question just because it has the word “best” in it.

P.P.S. I’m using PHP 5.3 on RHEL 5.

How to&Answers:

For reference, PECL AMQP Extension and http://php.net/manual/fa/book.amqp.php are the same thing, one is the package, the other the documentation for the package.

As a maintainer of the official PHP AMQP extension, I am a little biased. Many people use this extension in high volume low latency production environments since it is far faster than one written in native PHP. Furthermore, since I constantly use this at my job, I have to keep it working and up to date.

The drawback to this extension is that it is not available for Windows, yet, because the library on which it depends is currently being ported. There is not ETA for Windows support, but as soon as the dependencies support Windows, it is our goal to port the extension over to Windows as well.


This library seem to be alive and succeeding the original from code.google:


There are also tests and Travis CI.


Some info from initial review:

at an unknown point in the past and does not have a clear history or show what was changed, which results in an unfortunate fragmentation of efforts. It also appears to NOT be keeping up with bugfixes being applied to the original, a number of which have come in the last few months.

Also http://code.google.com/p/php-amqplib/ itself now appears to be no longer under active development, and a bad patch was applied over a month ago leaving the trunk in a broken state. (I submitted a patch to fix that, but this is a bad sign).


Having looked at both php-amqp and the PECL version, my impressions are that basic support for publishing and consuming messages is implemented. However, they will only work out of the box on *NIX platforms. You will have to jump through hoops to make them work on Windows (which may or may not be a problem depending on your development or deployment platform).

Bonus: https://github.com/tnc/php-amqplib is used in the MEAP book “RabbitMQ in Action”. Whether that will have any influence on its adoption remains to be seen.


There’s also https://github.com/bkw/php-amqp/ which I think is a mirror of http://code.google.com/p/php-amqplib/. I’ve had some trouble with that code: Notice messages during normal operation and all kinds of errors and warnings when there’s something wrong. The code also takes the PHP manual’s word for granted; for example, socket read calls are only checked against an error return, while in fact I’m just discovering that a socket close/timeout may be indicated by any of 4 different conditions.

I’m starting to think that a compiled library solution (i.e. a PHP extension) is the best option, particularly since there’re threading and socket issues, and PHP handles both poorly.


We are working on amqp interop. It tries to identify and standardize a common way for PHP programs to create, send, receive and read MQ messages through AMQP to achieve interoperability.

If you place a bet on it you can start with any interop compatible transport. You’ll still be able to change it in future, you are not locked in.

We currently supports enqueue/amqp-ext and enqueue/amqp-lib. First one works on top of php amqp extension where another adopts phpamqplib.