Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best PHP client library for accessing RabbitMQ (AMQP)?

Tags:

php

rabbitmq

amqp

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:

  • PHP manual page for AMQP
  • php-amqp - a client developed and used by StudiVZ, originally based on RabbitMQ-C
  • php-amqplib a port of py-amqplib
  • php-amqplib a fork of php-amqplib updated to support PHP 5.3
  • PECL release of the AMQP client

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.

like image 607
dkamins Avatar asked Dec 10 '10 05:12

dkamins


People also ask

What is RabbitMQ PHP?

PHP is a popular server-side scripting language with an officially recognized RabbitMQ library. The php-amqplib package is a pure PHP implementation of the AMQP 0.9. 1 protocol. In this article, we will show how to install and use php-amqplib through a RabbitMQ PHP example.

Is RabbitMQ a library?

Overview. The RabbitMQ Java client library allows Java and JVM-based applications to connect to and interact with RabbitMQ nodes.

How do I connect to RabbitMQ?

In order for a client to interact with RabbitMQ it must first open a connection. This process involves a number of steps: Application configures the client library it uses to use a certain connection endpoint (e.g. hostname and port) The library resolves the hostname to one or more IP addresses.


5 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.

like image 122
Pieter Avatar answered Oct 05 '22 21:10

Pieter


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

https://github.com/videlalvaro/php-amqplib

There are also tests and Travis CI.

like image 22
Tomas Dermisek Avatar answered Oct 05 '22 23:10

Tomas Dermisek


Some info from initial review:

https://github.com/tnc/php-amqplib forked http://code.google.com/p/php-amqplib/ 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).

like image 28
dkamins Avatar answered Oct 05 '22 22:10

dkamins


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.

like image 20
dimdm Avatar answered Oct 05 '22 22:10

dimdm


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.

like image 25
aib Avatar answered Oct 05 '22 22:10

aib