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

AbandonedArchivedLibrary

ipunkt/laravel-rabbitmq-enqueue
===============================

RabbitMQ with topic exchanges and routing keys via enqueue

1.5.7(4y ago)01.6k[4 issues](https://github.com/ipunkt/laravel-rabbitmq-enqueue/issues)1MITPHPPHP ^7.1.3|^8.0

Since Jun 7Pushed 4y ago3 watchersCompare

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

READMEChangelog (3)Dependencies (5)Versions (20)Used By (1)

Laravel Rabbitmq Enqueue
========================

[](#laravel-rabbitmq-enqueue)

This package uses php-enqueue to provide RabbitMQ support for laravel.

It specifically uses the enqueue amqp-ext functionality and thus required the amqp php extension.

Install
-------

[](#install)

This package is available through composer

```
composer require 'ipunkt/laravel-rabbitmq-enqueue:^1.0'

```

After installing publish the config and Provider through `vendor:publish`. It will create `config/rabbitmq.php` and `app/Providers/RabbitMQProvider.php`.

Add the RabbitMQProvider to your providers in the `config/app.php` and if necessary change its namespace from `App\` to whatever your app uses.

### Environment

[](#environment)

The default `config/rabbitmq.php` builds the dsn required to connect to rabbitmq through the following environment variables, default values behind the name:

- RMQ\_USERNAME - guest
- RMQ\_PASSWORD - guest
- RMQ\_HOST - rabbitmq
- RMQ\_PORT - 5672
- RMQ\_VHOST - /

Use
---

[](#use)

### Listen

[](#listen)

Listening is done by running the `rabbitmq:listen` command. It will connect to the dsn specified in the config file and create all required queues, exchanges and bindings between the two.

Which queues, exchanges and bindings it both creates and listens to is defined in the published RabbitMQProvider

#### Waiting

[](#waiting)

Because `rabbitmq:listen` is expected to run in a cloud environment it brings the switch `-w SECONDS` to wait the given amount of seconds before trying to connect, or even do anything at all.

It is possible to achieve the same by putting a sleep before the command but the frequency of this use case made me include this small nod to cloud environments needing to set up dns and jaeger agents needing to start for ease of use.

#### Handler

[](#handler)

Reacting to messages is done through a Handler. A handler is any class implementing the interface `Ipunkt\RabbitMQ\MessageHandler\Handler`. Register your handlers to routing keys in the published RabbitMQProvider

It is handed an AmqpMessage object in which you will most likely want to decode the $message-&gt;getBody() from json as it is currently the only format sent by the sender ofthis package.

#### Results

[](#results)

The following results can be handed back from your Handler to the command:

- `Processor::ACK` - the message was handled successfully. It will be dropped from the queue as success
- `Processor::REJECT` - the message does not concern this service or is malformed. It will be dropped from the queue as failure
- `Processor::REQUEUE` - the message is valid and expected to work but external circumstance prevents its handling at the current time. It will be moved to a waiting queue from which it will return after 10 seconds.
- Throwable or Exception - a Throwable or Exception reaching the command will be treated as `Processor::REQUEUE` before rethrowing the Throwable/Exception to the surrounding laravel code.
    The logic here is that an error in the code caused this and thus the message is expected to process but can't until a new version is deployed.
    Rethrowing the Exception should cause general exception handling to happen, for example notifying the developers through a system such as Sentry
- Exception implementing DropsMessage - Exceptions

### Sending

[](#sending)

Sending is provided through `Ipunkt\RabbitMQ\Sender\RabbitMQ`. It is not a facade so injecting it as a dependency is recommended.

#### send to Exchange

[](#send-to-exchange)

Sending to an exchange is the expected use case as it provides lose coupling with the services that consume your messages

```
$this-rabbitmq->publish([
	'some' => 'data',
	'serializable' => 'as',
	'json'
])->onExchange('exchange-name', 'routing-key')
```

#### send to Queue

[](#send-to-queue)

Sending directly to a target queue is also possible

```
$this-rabbitmq->publish([
	'some' => 'data',
	'serializable' => 'as',
	'json'
])->onQueue('queue-name')
```

Why specifically RabbitMQ instead of the generalized functions
--------------------------------------------------------------

[](#why-specifically-rabbitmq-instead-of-the-generalized-functions)

The generalized enqueue interfaces do not support routing key based routing.

The available SimpleClient simulates routing key based routing by using fanout exchanges and dropping unwanted messages in the client code.
It simulates a behaviour supported by RabbitMQ itself. And thus causes unecessary overhead in the services sharing exchanges but only interested in certain routing keys.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~117 days

Total

18

Last Release

1569d ago

PHP version history (2 changes)1.0.0PHP ^7.1.3

1.5.5PHP ^7.1.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f1ab6ff16fc96d20efd363563c961db68587721536c6559d692f461588a1246?d=identicon)[svensp](/maintainers/svensp)

---

Top Contributors

[![svensp](https://avatars.githubusercontent.com/u/7204121?v=4)](https://github.com/svensp "svensp (3 commits)")[![vafSpeckmaier](https://avatars.githubusercontent.com/u/233957372?v=4)](https://github.com/vafSpeckmaier "vafSpeckmaier (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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