PHPackages                             cmdrsharp/amqp-route-messenger - 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. cmdrsharp/amqp-route-messenger

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

cmdrsharp/amqp-route-messenger
==============================

A client for publishing and listening for routed exchange messages.

1.2.0.1(7y ago)135MITPHPPHP &gt;=7.2

Since Apr 5Pushed 7y ago2 watchersCompare

[ Source](https://github.com/CmdrSharp/amqp-route-messenger)[ Packagist](https://packagist.org/packages/cmdrsharp/amqp-route-messenger)[ RSS](/packages/cmdrsharp-amqp-route-messenger/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (9)Dependencies (4)Versions (10)Used By (0)

About
=====

[](#about)

[![Latest Stable Version](https://camo.githubusercontent.com/cb2808b8ff4cb84ee75fd2fc6fe3958938745a7d4fe3bfa426f5ceac4f46ad3d/68747470733a2f2f706f7365722e707567782e6f72672f636d647273686172702f616d71702d726f7574652d6d657373656e6765722f762f737461626c65)](https://packagist.org/packages/cmdrsharp/amqp-route-messenger)[![Build Status](https://camo.githubusercontent.com/74ecebffcd4de43c2fc9da1c3dbb4798730e6b1202b33f718800e3503635fe83/68747470733a2f2f7472617669732d63692e6f72672f436d647253686172702f616d71702d726f7574652d6d657373656e6765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CmdrSharp/amqp-route-messenger)[![StyleCI](https://camo.githubusercontent.com/bf8dd9e17bdabfbabd2b5f73a5c661ac333af21169ae2676fdcd7cc79a1e8427/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132383131363935302f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/128116950)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/780fc63e9571d941b84329a45204b0723da6c3ac5f39ef975f96174e59ea34ee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436d647253686172702f616d71702d726f7574652d6d657373656e6765722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/CmdrSharp/amqp-route-messenger/?branch=master)[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE)

A client for publishing and listening for routed exchange messages.

Current Requirements
====================

[](#current-requirements)

- PHP 7.2 or newer
- Laravel [5.8](https://laravel.com/docs/5.8) or newer

Installation
============

[](#installation)

Via composer

```
$ composer require cmdrsharp/amqp-route-messenger
```

After installation, publish the configuration file.

```
php artisan vendor:publish --provider="CmdrSharp\AmqpRouteMessenger\AmqpRouteMessengerServiceProvider"

```

Which will create a `amqproutemessenger.php` file in your Laravel config directory. This will contain bindings for the RabbitMQ Queue Details. It is recommended to simply define these in your `.env` file. The config file will automatically read from these values.

```
RABBITMQ_HOST=
RABBITMQ_PORT=5672
RABBITMQ_VHOST=/
RABBITMQ_LOGIN=
RABBITMQ_PASSWORD=

```

For SSL Connections, just specify (in your .env file) the path to the CA Certificate, and whether to use peer verification. If these are specified, an `AMQPSSLConnection` will be established.

```
RABBITMQ_CA_FILE="/path/to/yourca.crt"
RABBITMQ_VERIFY_PEER=true

```

Usage
=====

[](#usage)

Inject the contract into the class where you need the client:

```
/**
 * @var ClientInterface
 */
protected $client;

/**
 * @param ClientInterface $client
 */
public function __construct(ClientInterface $client)
{
    $this->client = $client;
}
```

Alternatively, if you don't wish to autoload, you may also require it directly.

```
use CmdrSharp\AmqpRouteMessenger\Client;

/**
 * @var ClientInterface
 */
protected $client;

public function __construct()
{
    $this->client = new Client();
}
```

Example: Publish a message with a correlation ID
------------------------------------------------

[](#example-publish-a-message-with-a-correlation-id)

All we are doing here is declaring which exchange to publish the message to, and then publishing it with a specified correlation ID. `declareExchange` accepts an optional second parameter which makes it [passive](https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare.passive)

```
$instance = $this->client->declareExchange('messages')->publish('correlation_id', 'your message');

// Don't forget to close the channel and connection when done!
$instance->closeChannel()->closeConnection();
```

Example: Read a message with a correlation ID
---------------------------------------------

[](#example-read-a-message-with-a-correlation-id)

It is recommended that the consumer is set up prior to any messages being published. This is to ensure that the queue bindings have been created, so that published messages are routed correctly.

```
$instance = $this->client->declareExchange('messages')
	->declareQueue()
	->bindQueue('correlation_id');

// Note: Reading does freeze the thread until it receives a message.
$message = $instance->read();

// Again, don't forget to close the channel and connection!
$instance->closeChannel()->closeConnection();
```

Example: Reading and Publishing put together
--------------------------------------------

[](#example-reading-and-publishing-put-together)

```
$instance = $this->client->declareExchange('messages')
	->declareQueue()
	->bindQueue('correlation_id');

$instance->publish('correlation_id', 'your message');

$message = $instance->read(10); // Optional timeout in seconds.

$instance->closeChannel()->closeConnection();
```

Versioning
==========

[](#versioning)

This package follows [Explicit Versioning](https://github.com/exadra37-versioning/explicit-versioning).

Authors
=======

[](#authors)

[CmdrSharp](https://github.com/CmdrSharp)

License
=======

[](#license)

[The MIT License (MIT)](LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~48 days

Recently: every ~96 days

Total

9

Last Release

2569d ago

PHP version history (4 changes)1.0.0.0-RC1PHP &gt;=7.1

1.1.0.0PHP 7.1.\*||7.2.\*

1.2.0.0PHP 7.2.\*||7.3.\*

1.2.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3df8f99d6d2e30affeb17bb7d3dab0a5c4142cbcd1ef0e7654097c28f2996249?d=identicon)[CmdrSharp](/maintainers/CmdrSharp)

---

Top Contributors

[![CmdrSharp](https://avatars.githubusercontent.com/u/5938745?v=4)](https://github.com/CmdrSharp "CmdrSharp (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cmdrsharp-amqp-route-messenger/health.svg)

```
[![Health](https://phpackages.com/badges/cmdrsharp-amqp-route-messenger/health.svg)](https://phpackages.com/packages/cmdrsharp-amqp-route-messenger)
```

###  Alternatives

[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2752.3M7](/packages/bschmitt-laravel-amqp)[stancl/jobpipeline

Turn any series of jobs into Laravel listeners.

1226.6M10](/packages/stancl-jobpipeline)[jwage/phpamqplib-messenger

Symfony messenger transport for the php-amqplib/php-amqplib library.

84149.7k1](/packages/jwage-phpamqplib-messenger)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[mookofe/tail

RabbitMQ and PHP client for Laravel and Lumen that allows you to add and listen queues messages just simple

5552.5k](/packages/mookofe-tail)[palpalani/laravel-sqs-queue-json-reader

Custom SQS queue reader for Laravel

26109.8k](/packages/palpalani-laravel-sqs-queue-json-reader)

PHPackages © 2026

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