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

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

smskin/laravel-rabbitmq
=======================

RabbitMQ provider for laravel projects

1.0.3(1y ago)052[1 PRs](https://github.com/smskin/laravel-rabbitmq/pulls)MITPHPPHP ^8.1CI passing

Since Oct 1Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/smskin/laravel-rabbitmq)[ Packagist](https://packagist.org/packages/smskin/laravel-rabbitmq)[ RSS](/packages/smskin-laravel-rabbitmq/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (6)Used By (0)

RabbitMQ (AMQP) Library for Laravel
===================================

[](#rabbitmq-amqp-library-for-laravel)

This library is based on the [smskin/laravel-daemon-supervisor](https://packagist.org/packages/smskin/laravel-daemon-supervisor) and [https://packagist.org/packages/php-amqplib/php-amqplib](php-amqplib/php-amqplib) libraries.

The library allows you to configure, listen to RabbitMQ queues, and send messages to the broker's exchange.

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

[](#installation)

```
composer required smskin/laravel-rabbitmq
php artisan vendor:publish --provider="SMSkin\LaravelRabbitMq\Providers\ServiceProvider"
```

Configuration
-------------

[](#configuration)

Settings are located in the `config/rabbitmq.php` file.

### Connection Settings

[](#connection-settings)

RabbitMQ connection settings.

### Sharding - Load Balancing

[](#sharding---load-balancing)

Settings for distributing messages across incoming message handler processes.

`strategy` - sharding strategy.

Available strategies:

- ONE\_SHARD - one process listens to all messages
- EVERY\_CONSUMER - each consumer has a separate process
- MAX\_LIMIT - launches `max_shards` processes, messages are distributed evenly among them

### Exchanges

[](#exchanges)

Registration of RabbitMQ exchanges.

### Exchange Bindings

[](#exchange-bindings)

Registration of bindings between Exchanges.

### Queues

[](#queues)

Registration of queues.

### Queue Bindings

[](#queue-bindings)

Registration of bindings from Exchanges to queues.

### Consumers

[](#consumers)

Registration of incoming message handlers.

Structure
---------

[](#structure)

### Exchange

[](#exchange)

Class inherits from `SMSkin\LaravelRabbitMq\Entities\Exchange`.

### Exchange Binding

[](#exchange-binding)

Allows routing messages from one exchange to others.

Class inherits from `SMSkin\LaravelRabbitMq\Entities\Binding`.

Refer to the base class for configuration rules as per AMQP documentation.

Methods to implement:

- `public function getSource(): string` - Returns the source Exchange name.
- `public function getDestination(): string` - Returns the destination Exchange name.

Refer to the base class for configuration rules as per AMQP documentation.

### Queue

[](#queue)

Class inherits from `SMSkin\LaravelRabbitMq\Entities\Queue`.

Refer to the base class for configuration rules as per AMQP documentation.

### Queue Binding

[](#queue-binding)

Class inherits from `SMSkin\LaravelRabbitMq\Entities\Binding`.

Allows routing messages from an Exchange to a queue.

Methods to implement:

- `public function getSource(): string` - Returns the source Exchange name.
- `public function getDestination(): string` - Returns the destination Queue name.

Refer to the base class for configuration rules as per AMQP documentation.

### Consumer

[](#consumer)

Incoming message handler. Class inherits from `SMSkin\LaravelRabbitMq\Entities\Consumer`.

Methods to implement:

- `public function getQueue(): string` - Returns the name of the queue this handler listens to.
- `public function handleMessage(AMQPMessage $message): void` - Handles the message.
- The `handleMessage(AMQPMessage $message)` method should end with marking the message as processed (`$message->ack();`).

Aim for the `handleMessage(AMQPMessage $message)` method to execute in minimal time to avoid becoming a bottleneck in queue processing.

Logic
-----

[](#logic)

This library includes 2 artisan commands:

- `rmq:supervisor` - Master process
- `rmq:worker` - Worker process

When running `rmq:supervisor`, the library configures RabbitMQ according to the configuration file and starts worker processes based on the selected strategy (`rabbitmq.sharding.strategy`).

When a message appears in the listening queue, the `handleMessage(AMQPMessage $message)` method of the subscribed handler is triggered.

Usage in Laravel
----------------

[](#usage-in-laravel)

Add the command `php artisan rmq:supervisor` to your [supervisor](https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps) configuration. Upon starting, supervisor will launch the master process.

```
[program:laravel-rmq-supervisor]
process_name=%(program_name)s
command=php /var/www/html/artisan rmq:supervisor
autostart=true
autorestart=true
user=www-data
group=www-data
redirect_stderr=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_maxbytes=0
stderr_maxbytes=0
stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0
startsecs=0
stopwaitsecs=3600

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~59 days

Total

4

Last Release

409d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92de9daad6e0c4ef7b8b4fa112373401ae79ac02d185653724ca4ac425add1b7?d=identicon)[smskin](/maintainers/smskin)

---

Top Contributors

[![smskin](https://avatars.githubusercontent.com/u/3227797?v=4)](https://github.com/smskin "smskin (19 commits)")

---

Tags

laravelrabbitmqAMQP

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2752.3M7](/packages/bschmitt-laravel-amqp)[convenia/pigeon

3233.0k](/packages/convenia-pigeon)[kunalvarma05/laravel-rabbitmq

Work with RabbitMQ in Laravel.

1853.7k](/packages/kunalvarma05-laravel-rabbitmq)[iamfarhad/laravel-rabbitmq

A robust RabbitMQ driver for Laravel Queue with advanced message queuing, reliable delivery, and high-performance async processing capabilities

3215.6k](/packages/iamfarhad-laravel-rabbitmq)

PHPackages © 2026

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