PHPackages                             iamfarhad/laravel-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. iamfarhad/laravel-rabbitmq

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

iamfarhad/laravel-rabbitmq
==========================

Native ext-amqp RabbitMQ queue driver for Laravel production workloads with connection pooling, publisher confirms, Horizon support, Octane support, quorum queues, and high-performance workers

1.3.0(1mo ago)3319.5k↓39.7%3[2 issues](https://github.com/iamfarhad/LaravelRabbitMQ/issues)MITPHPPHP ^8.2CI passing

Since Dec 30Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/iamfarhad/LaravelRabbitMQ)[ Packagist](https://packagist.org/packages/iamfarhad/laravel-rabbitmq)[ Docs](https://github.com/iamfarhad/laravel-rabbitmq)[ GitHub Sponsors](https://github.com/iamfarhad)[ RSS](/packages/iamfarhad-laravel-rabbitmq/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (15)Versions (32)Used By (0)

Laravel RabbitMQ
================

[](#laravel-rabbitmq)

[![Latest Stable Version](https://camo.githubusercontent.com/9457cf5f8debe0f93d06a9677aafcc02d3b6a0e1276413b22d215f3bb6b2dcff/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f6c61726176656c2d7261626269746d712f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/iamfarhad/laravel-rabbitmq)[![Total Downloads](https://camo.githubusercontent.com/a99bce6d9288cff1adec2c016cb1edad005eb2d70c5ed0efc23f585a918b93f0/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f6c61726176656c2d7261626269746d712f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/iamfarhad/laravel-rabbitmq)[![License](https://camo.githubusercontent.com/b14f56c833f6d12ac298e3a36aa2bfaff1d39a79a2cd16442a15c76c18302631/68747470733a2f2f706f7365722e707567782e6f72672f69616d6661726861642f6c61726176656c2d7261626269746d712f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/iamfarhad/laravel-rabbitmq)[![Tests](https://github.com/iamfarhad/LaravelRabbitMQ/actions/workflows/tests.yml/badge.svg)](https://github.com/iamfarhad/LaravelRabbitMQ/actions/workflows/tests.yml)

Native `ext-amqp` RabbitMQ queue driver for Laravel production workloads.

Built for teams that control their infrastructure and want native RabbitMQ performance for long-running Laravel workers, connection/channel pooling, publisher confirms, quorum queues, Horizon support, Octane support, and RabbitMQ 3.13 / 4.x readiness.

Why this package?
-----------------

[](#why-this-package)

Most Laravel RabbitMQ packages optimize for Composer-only installation. This package intentionally optimizes for production systems where the PHP runtime can include native `ext-amqp`.

Use it when you want:

- Laravel Queue API compatibility.
- Native `ext-amqp` implementation.
- Connection and channel pooling with health checks and retry backoff.
- Multi-host production configuration.
- Configurable exchanges, exchange types, and routing keys.
- Lazy queues, priority queues, quorum queues, delayed messages, dead-letter routing, and failed-message rerouting.
- Publisher confirms, transactions, RPC helpers, exchange helpers, and queue management helpers.
- Optional Laravel Horizon integration.
- Optional Laravel Octane pool reset support.
- Optional high-performance `basic_consume` worker mode.
- Artisan commands for declaring exchanges, declaring queues, purging queues, deleting queues, and viewing pool stats.

Documentation
-------------

[](#documentation)

- [Why native ext-amqp?](docs/why-native-ext-amqp.md)
- [Installation guide](docs/installation.md)
- [Production deployment guide](docs/production.md)
- [Recipes](docs/recipes.md)
- [Benchmarks](docs/benchmarks.md)
- [Support policy and compatibility matrix](SUPPORT.md)
- [Security policy](SECURITY.md)
- [Contributing guide](CONTRIBUTING.md)
- [Upgrade guide](UPGRADE.md)
- [Migration guide](MIGRATION.md)
- [Comparison with `vladimir-yuldashev/laravel-queue-rabbitmq`](docs/comparison-vladimir-yuldashev.md)

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

[](#requirements)

- PHP 8.2 or higher.
- Laravel 10.x, 11.x, 12.x, or 13.x according to the Composer constraints.
- RabbitMQ 3.13 or 4.x for the primary supported/tested matrix; RabbitMQ 3.8-3.12 is best effort.
- `ext-amqp` PHP extension.
- `ext-pcntl` only when running `rabbitmq:consume --num-processes` with a value greater than `1`.

See [SUPPORT.md](SUPPORT.md) for the full Laravel/PHP/RabbitMQ support matrix.

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

[](#installation)

```
composer require iamfarhad/laravel-rabbitmq
```

Install the AMQP extension when it is not already available:

```
pecl install amqp
```

For Debian/Ubuntu images, install the native dependency first:

```
sudo apt-get update
sudo apt-get install -y librabbitmq-dev libssh-dev
sudo pecl install amqp
```

For Docker, Alpine, Laravel Sail, and GitHub Actions examples, see the [installation guide](docs/installation.md).

Publish the config:

```
php artisan vendor:publish \
  --provider="iamfarhad\\LaravelRabbitMQ\\LaravelRabbitQueueServiceProvider" \
  --tag="config"
```

Set Laravel to use RabbitMQ:

```
QUEUE_CONNECTION=rabbitmq
```

Quick start
-----------

[](#quick-start)

Start RabbitMQ locally:

```
docker run -d --name rabbitmq \
  -p 5672:5672 \
  -p 15672:15672 \
  rabbitmq:3.13-management
```

Configure your application:

```
QUEUE_CONNECTION=rabbitmq
RABBITMQ_HOST=127.0.0.1
RABBITMQ_PORT=5672
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_VHOST=/
RABBITMQ_QUEUE=default
```

Dispatch Laravel jobs normally:

```
dispatch(new App\Jobs\ProcessPodcast($podcast));
dispatch(new App\Jobs\ProcessPodcast($podcast))->onQueue('podcasts');
dispatch(new App\Jobs\ProcessPodcast($podcast))->delay(now()->addMinutes(10));
```

Run a worker:

```
php artisan rabbitmq:consume --queue=default --num-processes=1
```

Laravel's default worker also works:

```
php artisan queue:work rabbitmq --queue=default
```

Production baseline
-------------------

[](#production-baseline)

For production, start with explicit heartbeat, timeout, retry, and health-check settings:

```
QUEUE_CONNECTION=rabbitmq
RABBITMQ_CONSUME_MODE=consume
RABBITMQ_HEARTBEAT_CONNECTION=30
RABBITMQ_CONNECT_TIMEOUT=10
RABBITMQ_READ_TIMEOUT=30
RABBITMQ_WRITE_TIMEOUT=30
RABBITMQ_MAX_RETRIES=3
RABBITMQ_RETRY_DELAY=1000
RABBITMQ_HEALTH_CHECK_ENABLED=true
RABBITMQ_HEALTH_CHECK_INTERVAL=30
```

See [production deployment](docs/production.md) for Supervisor, systemd, Docker Compose, Kubernetes, prefetch, publisher confirms, quorum queues, and dead-letter routing examples.

Configuration highlights
------------------------

[](#configuration-highlights)

### Multi-host configuration

[](#multi-host-configuration)

```
'hosts' => [
    [
        'host' => 'rabbitmq-1',
        'port' => 5672,
        'user' => 'laravel',
        'password' => 'secret',
        'vhost' => '/',
    ],
    [
        'host' => 'rabbitmq-2',
        'port' => 5672,
        'user' => 'laravel',
        'password' => 'secret',
        'vhost' => '/',
    ],
],
```

### Pool configuration

[](#pool-configuration)

```
RABBITMQ_MAX_CONNECTIONS=10
RABBITMQ_MIN_CONNECTIONS=2
RABBITMQ_MAX_CHANNELS_PER_CONNECTION=100
RABBITMQ_MAX_RETRIES=3
RABBITMQ_RETRY_DELAY=1000
RABBITMQ_HEALTH_CHECK_ENABLED=true
RABBITMQ_HEALTH_CHECK_INTERVAL=30
```

### Publishing topology

[](#publishing-topology)

```
RABBITMQ_EXCHANGE=jobs
RABBITMQ_EXCHANGE_TYPE=topic
RABBITMQ_EXCHANGE_ROUTING_KEY=jobs.%s
```

`%s` is replaced with the Laravel queue name. For example, queue `emails` publishes with routing key `jobs.emails`.

Worker modes
------------

[](#worker-modes)

### Poll mode

[](#poll-mode)

`poll` is the default and uses `basic_get`. It is the safest mode and matches Laravel's worker lifecycle expectations.

```
php artisan rabbitmq:consume --queue=default --consume-mode=poll
```

### Consume mode

[](#consume-mode)

`consume` uses RabbitMQ's `basic_consume` push-style delivery. It avoids polling overhead and is better for hot queues.

```
php artisan rabbitmq:consume --queue=default --consume-mode=consume
```

For `consume` mode, prefer one queue per worker process. Scale with Supervisor `numprocs`, containers, or Kubernetes replicas.

Common recipes
--------------

[](#common-recipes)

See [recipes](docs/recipes.md) for copy-paste examples covering:

- Delayed jobs.
- Quorum queues.
- Priority queues.
- Publisher confirms.
- Dead-letter routing.
- Horizon.
- Octane.
- Multi-host failover.
- Hot queue workers.

Admin commands
--------------

[](#admin-commands)

```
# Pool stats
php artisan rabbitmq:pool-stats
php artisan rabbitmq:pool-stats --json
php artisan rabbitmq:pool-stats --watch --interval=5

# Exchanges
php artisan rabbitmq:exchange-declare jobs --type=topic

# Queues
php artisan rabbitmq:queue-declare orders --durable=1
php artisan rabbitmq:queue-declare bulk --lazy=1
php artisan rabbitmq:queue-declare quorum-orders --quorum=1
php artisan rabbitmq:queue-declare critical --priority=10
php artisan rabbitmq:queue-purge orders --force
php artisan rabbitmq:queue-delete orders --force
```

Testing and quality
-------------------

[](#testing-and-quality)

```
composer format-test
composer analyse
composer test
```

Troubleshooting
---------------

[](#troubleshooting)

### `Class AMQPConnection not found`

[](#class-amqpconnection-not-found)

Install and enable `ext-amqp`:

```
pecl install amqp
php -m | grep amqp
```

For detailed installation options, see [installation guide](docs/installation.md).

### Parallel worker error about `pcntl`

[](#parallel-worker-error-about-pcntl)

Install `ext-pcntl`, or run a single process:

```
php artisan rabbitmq:consume --queue=default --num-processes=1
```

### Horizon events do not appear

[](#horizon-events-do-not-appear)

Confirm Horizon is installed and set:

```
RABBITMQ_WORKER=horizon
```

Then restart your workers.

Support the project
-------------------

[](#support-the-project)

If this package helps you run RabbitMQ in production with Laravel, please consider giving it a star. It helps other production teams discover the project.

Security
--------

[](#security)

Please report vulnerabilities privately. See [SECURITY.md](SECURITY.md).

Contributing
------------

[](#contributing)

Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for more information.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 97% of commits — single point of failure

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

Every ~56 days

Recently: every ~61 days

Total

23

Last Release

52d ago

Major Versions

v0.1.2 → 1.0.02025-09-10

PHP version history (2 changes)v0.0.1PHP ^8.1

v0.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1b05d2b55c6b0a962f79ea662f2920619c3d6b1ae2845127ce2b68189f192a8?d=identicon)[iamfarhad](/maintainers/iamfarhad)

---

Top Contributors

[![iamfarhad](https://avatars.githubusercontent.com/u/1936147?v=4)](https://github.com/iamfarhad "iamfarhad (259 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![algins](https://avatars.githubusercontent.com/u/46065878?v=4)](https://github.com/algins "algins (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

amqplaravellaravel-queue-rabbitmqlumenmessage-brokermessage-queuequeuerabbitmqrmqphplaravelevent-drivenlaravel-packagerabbitmqmessage queueAMQPscalablepub-submicroserviceshigh-performancebackground-jobsdistributed systemslaravel-queuemessage-brokertask-queuequeue-managementqueue-driverasync-processingreliable-messaging

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/iamfarhad-laravel-rabbitmq/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[nuwber/rabbitevents

The Nuwber RabbitEvents package

122529.7k4](/packages/nuwber-rabbitevents)[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2822.5M7](/packages/bschmitt-laravel-amqp)[vinelab/bowler

A Rabbitmq wrapper for Laravel

4660.7k1](/packages/vinelab-bowler)

PHPackages © 2026

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