0Pricing
PHP Academy · Lesson

Working with RabbitMQ in PHP

Publish and consume messages with RabbitMQ.

RabbitMQ in PHP

RabbitMQ is a broker that speaks AMQP 0-9-1. In PHP the canonical client is php-amqplib/php-amqplib (pure PHP) or the C-backed ext-amqp. This lesson uses php-amqplib because it runs anywhere Composer does.

The core AMQP model has three actors: exchanges receive messages, bindings route them by key, and queues hold them for consumers. Master this and the rest is detail.

Installing the Client

Add the library with Composer. It needs the sockets and bcmath extensions, both common in CLI PHP builds.

composer require php-amqplib/php-amqplib
# Connection target, e.g. amqp://guest:guest@localhost:5672/

All lessons in this course

  1. Why Asynchronous Messaging
  2. Working with RabbitMQ in PHP
  3. Apache Kafka with PHP
  4. Building Event-Driven Workflows
← Back to PHP Academy