PHPackages                             quillstack/queue-rabbitmq - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. quillstack/queue-rabbitmq

ActiveLibrary[Queues &amp; Workers](/categories/queues)

quillstack/queue-rabbitmq
=========================

A RabbitMQ driver for quillstack/queue: the broker holds the message until a worker says what became of it.

v0.1.0(today)02↑2900%MITPHPPHP ^8.1CI passing

Since Aug 25Pushed todayCompare

[ Source](https://github.com/quillstack/queue-rabbitmq)[ Packagist](https://packagist.org/packages/quillstack/queue-rabbitmq)[ Docs](https://quillstack.org/packages/queue-rabbitmq)[ RSS](/packages/quillstack-queue-rabbitmq/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

Quillstack Queue: RabbitMQ
==========================

[](#quillstack-queue-rabbitmq)

[![Tests](https://github.com/quillstack/queue-rabbitmq/actions/workflows/tests.yml/badge.svg)](https://github.com/quillstack/queue-rabbitmq/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/314d42224cfc0bfb2328dc3822a5093abd2a8f38cd022cfd69f28f1077cc463c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7175696c6c737461636b2f71756575652d7261626269746d712e737667)](https://packagist.org/packages/quillstack/queue-rabbitmq)[![Downloads](https://camo.githubusercontent.com/1232e872d4bf2c90710ef5bd2daae39bb3272d679df7458c18ccfd13bfccf7f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7175696c6c737461636b2f71756575652d7261626269746d712e737667)](https://packagist.org/packages/quillstack/queue-rabbitmq)[![PHP Version](https://camo.githubusercontent.com/6155b1b3985b66982788f598bb45aeefb0461cb814b821d9b311dcd333feec3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175696c6c737461636b2f71756575652d7261626269746d71)](https://packagist.org/packages/quillstack/queue-rabbitmq)[![StyleCI](https://camo.githubusercontent.com/0df503214e67cbbdcf29a0beb2bb1d3f056653b8aab9e1c9f1b10e7a3938e649/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f313334363538323437342f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/1346582474?branch=main)[![CodeFactor](https://camo.githubusercontent.com/639faaf3263c4def27efba50fbcc3f9e6e28fdc2ffbcd9b4634fcb5dcc50d4f5/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f7175696c6c737461636b2f71756575652d7261626269746d712f6261646765)](https://www.codefactor.io/repository/github/quillstack/queue-rabbitmq)[![Quality Gate](https://camo.githubusercontent.com/b00a68994f6f11479594d2734418f04cdd6b772a08b808c7534f2bf7b036e706/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f71756575652d7261626269746d71266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=quillstack_queue-rabbitmq)[![Coverage](https://camo.githubusercontent.com/023720f2eed3a1bd244b924509215f95552d379acd623c006f69705a69311a4c/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f71756575652d7261626269746d71266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=quillstack_queue-rabbitmq)[![Maintainability](https://camo.githubusercontent.com/dcaf886e71eab01bf092478f4f9615cc619dce6911a34ef66415c81719919206/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f71756575652d7261626269746d71266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=quillstack_queue-rabbitmq)[![Reliability](https://camo.githubusercontent.com/ffae1b384e6860afbec6faef3d06f3d7b7dc6c947e30b5e7f6b93abd9768c8f8/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f71756575652d7261626269746d71266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=quillstack_queue-rabbitmq)[![Security](https://camo.githubusercontent.com/90788c43b7c68609a319a4bd8910e0073c279008d663c27b85ba6fa0ed6abeb0/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7175696c6c737461636b5f71756575652d7261626269746d71266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=quillstack_queue-rabbitmq)[![License](https://camo.githubusercontent.com/68e78396c3cb836b9423939403206499089c24868d570c11f30132761ed71ea1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7175696c6c737461636b2f71756575652d7261626269746d71)](https://github.com/quillstack/queue-rabbitmq/blob/main/LICENSE)

A RabbitMQ driver for [quillstack/queue](https://github.com/quillstack/queue): the same `push`, `pop` and `ack`, with a broker holding the messages.

Why this exists
---------------

[](#why-this-exists)

The drivers in `quillstack/queue` keep messages somewhere the application already had — an array, a directory, a database table, Redis. That covers most of what an API needs, and the advice there is to start with the table, because one fewer thing that can be down at three in the morning is worth more than the microseconds.

This is for when you want what a broker has and the rest of it does not: messages that outlive the database, other things consuming the same queues, routing, mirroring across nodes.

**It is a separate package because it needs a library.** `quillstack/queue` requires nothing but PSR interfaces and weighs 512 KB with everything it pulls in; a driver that quietly needed `php-amqplib` would be a class whose manifest did not say what it needs, failing when it ran rather than when it was installed. `RedisQueue` stays in the main package because `ext-redis` is an extension, which is a different thing: it costs nothing to suggest and nothing to skip.

Requirements
------------

[](#requirements)

- PHP 8.1 or newer
- RabbitMQ 3.8 or newer
- [quillstack/queue](https://github.com/quillstack/queue) 0.8 or newer

Installation
------------

[](#installation)

```
composer require quillstack/queue-rabbitmq
```

Usage
-----

[](#usage)

```
use PhpAmqpLib\Connection\AMQPStreamConnection;
use Quillstack\QueueRabbitMq\RabbitQueue;

$connection = new AMQPStreamConnection('127.0.0.1', 5672, 'guest', 'guest');
$queue = new RabbitQueue($connection);

$queue->push(new SendWelcomeEmail('radek@quillstack.com'));

$envelope = $queue->pop();
$envelope->attempts;           // 1
$queue->ack($envelope);        // true
$queue->size();                // 0
```

It is a `Quillstack\Queue\Queue`, so everything built on that works over it unchanged — `Worker`, retries, delays and dead letters included.

### What the broker does instead of a timeout

[](#what-the-broker-does-instead-of-a-timeout)

The other drivers hold a message for a while and give it back when the reservation runs out. RabbitMQ does not need a clock: `pop` takes a message without acknowledging it, so the broker holds it against **this connection** and gives it back the moment the connection goes.

A worker that dies takes its connection with it, so the message is back in the queue at once rather than after a minute. That is the same promise kept better, and it is why there is no `$visibility` here to set.

### Delays

[](#delays)

RabbitMQ has no delayed delivery of its own without a plugin, so a held-back message goes onto a queue nothing reads, with a time to live, which dead-letters into the real queue when it expires. Nothing to install, and it is what the broker is for.

One caveat worth knowing: messages on that queue expire in the order they were put there, not in the order they come due. A message held for an hour in front of one held for a second will make the second wait. Where delays vary a great deal, the delayed-message-exchange plugin does this properly.

### Topics

[](#topics)

```
use Quillstack\Queue\Subscriptions;
use Quillstack\QueueRabbitMq\RabbitTopic;

$subscriptions = (new Subscriptions())
    ->subscribe('orders', 'orders.email')
    ->subscribe('orders', 'orders.ledger');

$topic = new RabbitTopic($connection, $subscriptions);

$topic->publish(new OrderPlaced($id), 'orders');
```

`Topics\QueueTopic` in the main package publishes once per subscriber, because a queue can only be told about one subscriber at a time. A broker does not need telling twice: the message goes to a fanout exchange and every bound queue gets a copy. One round trip instead of one per subscriber, and the copying is the broker's problem.

This is the whole reason `Topic` is an interface. The two do the same thing and share none of the work.

### Where this differs from the other drivers

[](#where-this-differs-from-the-other-drivers)

Said plainly, because a driver which quietly behaves differently is worse than one which does not exist:

- **`size()` counts what is waiting, not what is in flight.** The other drivers count reserved messages too. RabbitMQ does not report those over AMQP — only the management API does, and that is a plugin this does not ask anybody to install.
- **A message that comes back after a crash has the attempt count it was published with.** The other drivers count an attempt when the message is handed over. RabbitMQ redelivers the body it was given, and the count lives in that body. A message released by a worker *is* counted, because releasing republishes it; only a crash is invisible.

Benchmark
---------

[](#benchmark)

Not measured against another RabbitMQ driver for PHP, because the comparison would be between two ways of calling the same broker over the same library, and the answer would be the network. What a broker costs is a round trip; what this adds to it is a `serialize()`.

Measuring this against the drivers in `quillstack/queue` would be measuring RabbitMQ against SQLite, which says nothing about either.

Tests
-----

[](#tests)

```
composer test
```

They run against a real broker, because what is worth testing is what RabbitMQ does — that a message taken and not acknowledged is held rather than gone, and comes back when the connection does. Without one they skip themselves, so the suite still runs on a machine that has none; CI has a broker and a step that fails if it cannot be reached, because a green suite that tested nothing is worse than a red one.

```
docker run -d --rm -p 5672:5672 rabbitmq:3-alpine
AMQP_URL=amqp://guest:guest@127.0.0.1:5672 composer test
```

### Static analysis

[](#static-analysis)

```
composer stan
```

The rest of Quillstack
----------------------

[](#the-rest-of-quillstack)

This is one component of [Quillstack](https://github.com/quillstack), a PHP framework which is as simple to use as it is strict about what it does.

- [quillstack/queue](https://github.com/quillstack/queue) — the contract, and the drivers that need no broker
- [quillstack/framework](https://github.com/quillstack/framework) — where a queue is wired in
- [quillstack/clock](https://github.com/quillstack/clock) — what decides when a message is due
- [quillstack/logger](https://github.com/quillstack/logger) — where a worker says what went wrong

License
-------

[](#license)

MIT — see [LICENSE](https://github.com/quillstack/queue-rabbitmq/blob/main/LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44390595?v=4)[Radek Ziemniewicz](/maintainers/radek-ziemniewicz)[@radek-ziemniewicz](https://github.com/radek-ziemniewicz)

---

Tags

amqpmessagingphpphp8queuequillstackrabbitmqqueuerabbitmqmessagingAMQPphp8quillstack

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/quillstack-queue-rabbitmq/health.svg)

```
[![Health](https://phpackages.com/badges/quillstack-queue-rabbitmq/health.svg)](https://phpackages.com/packages/quillstack-queue-rabbitmq)
```

###  Alternatives

[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2812.6M7](/packages/bschmitt-laravel-amqp)[bunny/bunny

Performant pure-PHP AMQP (RabbitMQ) non-blocking ReactPHP library

7496.9M50](/packages/bunny-bunny)[enqueue/enqueue-bundle

Message Queue Bundle

27716.2M44](/packages/enqueue-enqueue-bundle)[enqueue/enqueue

Message Queue Library

19821.0M67](/packages/enqueue-enqueue)[nuwber/rabbitevents

The Nuwber RabbitEvents package

119535.0k4](/packages/nuwber-rabbitevents)[kdyby/rabbitmq

Integrates php-amqplib with RabbitMq and Nette Framework

27726.8k4](/packages/kdyby-rabbitmq)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
