PHPackages                             thitruongsicom/laravel-amqp - 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. thitruongsicom/laravel-amqp

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

thitruongsicom/laravel-amqp
===========================

AMQP wrapper for Laravel and Lumen to publish and consume messages

2.1.0(4y ago)02MITPHPPHP ^7.3|~8.0.0

Since Jun 29Pushed 3y agoCompare

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

READMEChangelog (2)Dependencies (8)Versions (22)Used By (0)

bschmitt/laravel-amqp
=====================

[](#bschmittlaravel-amqp)

AMQP wrapper for Laravel and Lumen to publish and consume messages especially from RabbitMQ

[![Build Status](https://camo.githubusercontent.com/81c39a820304e4b65c631a4e95c84e16f854195c18d3d4f9ae684732c515a52e/68747470733a2f2f7472617669732d63692e6f72672f627363686d6974742f6c61726176656c2d616d71702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bschmitt/laravel-amqp)[![Latest Stable Version](https://camo.githubusercontent.com/89a5fa9a6aa3228fbccd3de2d6251828dc16a2a7ef504c3ca9f3fc03507748fc/68747470733a2f2f706f7365722e707567782e6f72672f627363686d6974742f6c61726176656c2d616d71702f762f737461626c652e737667)](https://packagist.org/packages/bschmitt/laravel-amqp)[![License](https://camo.githubusercontent.com/25bc1a3091d0ba10777b5d152d8133de1d5557c73df4781aba72512789917955/68747470733a2f2f706f7365722e707567782e6f72672f627363686d6974742f6c61726176656c2d616d71702f6c6963656e73652e737667)](https://packagist.org/packages/bschmitt/laravel-amqp)

Features
--------

[](#features)

- Advanced queue configuration
- Add message to queues easily
- Listen queues with useful options

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

[](#installation)

### Composer

[](#composer)

Add the following to your require part within the composer.json:

```
"bschmitt/laravel-amqp": "2.*" (Laravel >= 5.5)
"bschmitt/laravel-amqp": "1.*" (Laravel  'production',

    'properties' => [

        'production' => [
            'host'                => 'localhost',
            'port'                => 5672,
            'username'            => 'username',
            'password'            => 'password',
            'vhost'               => '/',
            'exchange'            => 'amq.topic',
            'exchange_type'       => 'topic',
            'consumer_tag'        => 'consumer',
            'ssl_options'         => [], // See https://secure.php.net/manual/en/context.ssl.php
            'connect_options'     => [], // See https://github.com/php-amqplib/php-amqplib/blob/master/PhpAmqpLib/Connection/AMQPSSLConnection.php
            'queue_properties'    => ['x-ha-policy' => ['S', 'all']],
            'exchange_properties' => [],
            'timeout'             => 0
        ],

    ],

];
```

Register the Lumen Service Provider in **bootstrap/app.php**:

```
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
*/

//...

$app->configure('amqp');
$app->register(Bschmitt\Amqp\LumenServiceProvider::class);

//...
```

Add Facade Support for Lumen 5.2+

```
//...
$app->withFacades(true, [
    'Bschmitt\Amqp\Facades\Amqp' => 'Amqp',
]);
//...
```

### Laravel

[](#laravel)

Open **config/app.php** and add the service provider and alias:

```
'Bschmitt\Amqp\AmqpServiceProvider',
```

```
'Amqp' => 'Bschmitt\Amqp\Facades\Amqp',
```

Publishing a message
--------------------

[](#publishing-a-message)

### Push message with routing key

[](#push-message-with-routing-key)

```
    Amqp::publish('routing-key', 'message');
```

### Push message with routing key and create queue

[](#push-message-with-routing-key-and-create-queue)

```
    Amqp::publish('routing-key', 'message' , ['queue' => 'queue-name']);
```

### Push message with routing key and overwrite properties

[](#push-message-with-routing-key-and-overwrite-properties)

```
    Amqp::publish('routing-key', 'message' , ['exchange' => 'amq.direct']);
```

Consuming messages
------------------

[](#consuming-messages)

### Consume messages, acknowledge and stop when no message is left

[](#consume-messages-acknowledge-and-stop-when-no-message-is-left)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

   $resolver->stopWhenProcessed();

});
```

### Consume messages forever

[](#consume-messages-forever)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

});
```

### Consume messages, with custom settings

[](#consume-messages-with-custom-settings)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

}, [
	'timeout' => 2,
	'vhost'   => 'vhost3'
]);
```

Fanout example
--------------

[](#fanout-example)

### Publishing a message

[](#publishing-a-message-1)

```
\Amqp::publish('', 'message' , [
    'exchange_type' => 'fanout',
    'exchange' => 'amq.fanout',
]);
```

### Consuming messages

[](#consuming-messages-1)

```
\Amqp::consume('', function ($message, $resolver) {
    var_dump($message->body);
    $resolver->acknowledge($message);
}, [
    'routing' => '',
    'exchange' => 'amq.fanout',
    'exchange_type' => 'fanout',
    'queue_force_declare' => true,
    'queue_exclusive' => true,
    'persistent' => true // required if you want to listen forever
]);
```

Credits
-------

[](#credits)

- Some concepts were used from

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~88 days

Total

21

Last Release

1689d ago

Major Versions

1.2.6 → 2.0.02018-06-01

PHP version history (3 changes)1.2.1PHP &gt;=5.5.9

2.0.0PHP &gt;=7.0

2.1.0PHP ^7.3|~8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0bde97b65db73121c347d0b728a99c7320b68907da3eb73a8f539c9b8a6aaa6a?d=identicon)[lequi](/maintainers/lequi)

---

Top Contributors

[![bschmitt](https://avatars.githubusercontent.com/u/239644?v=4)](https://github.com/bschmitt "bschmitt (55 commits)")[![petekelly](https://avatars.githubusercontent.com/u/1177933?v=4)](https://github.com/petekelly "petekelly (6 commits)")[![mirkojotic](https://avatars.githubusercontent.com/u/10652272?v=4)](https://github.com/mirkojotic "mirkojotic (6 commits)")[![stevenklar](https://avatars.githubusercontent.com/u/379650?v=4)](https://github.com/stevenklar "stevenklar (5 commits)")[![ni-bschmitt](https://avatars.githubusercontent.com/u/58559970?v=4)](https://github.com/ni-bschmitt "ni-bschmitt (4 commits)")[![SpaceK33z](https://avatars.githubusercontent.com/u/533616?v=4)](https://github.com/SpaceK33z "SpaceK33z (4 commits)")[![xaviapa](https://avatars.githubusercontent.com/u/8439057?v=4)](https://github.com/xaviapa "xaviapa (3 commits)")[![Cellard](https://avatars.githubusercontent.com/u/1220316?v=4)](https://github.com/Cellard "Cellard (3 commits)")[![junaidnasir](https://avatars.githubusercontent.com/u/10703810?v=4)](https://github.com/junaidnasir "junaidnasir (3 commits)")[![jwkblades](https://avatars.githubusercontent.com/u/517211?v=4)](https://github.com/jwkblades "jwkblades (3 commits)")[![Pe46dro](https://avatars.githubusercontent.com/u/6197075?v=4)](https://github.com/Pe46dro "Pe46dro (2 commits)")[![smartyaunt](https://avatars.githubusercontent.com/u/12381885?v=4)](https://github.com/smartyaunt "smartyaunt (2 commits)")[![joskfg](https://avatars.githubusercontent.com/u/524887?v=4)](https://github.com/joskfg "joskfg (2 commits)")[![josemanuel-cardona](https://avatars.githubusercontent.com/u/196229448?v=4)](https://github.com/josemanuel-cardona "josemanuel-cardona (2 commits)")[![hertzigger](https://avatars.githubusercontent.com/u/4991108?v=4)](https://github.com/hertzigger "hertzigger (2 commits)")[![MattBearson](https://avatars.githubusercontent.com/u/17829867?v=4)](https://github.com/MattBearson "MattBearson (1 commits)")[![alupuleasa](https://avatars.githubusercontent.com/u/26110108?v=4)](https://github.com/alupuleasa "alupuleasa (1 commits)")[![dennisgon](https://avatars.githubusercontent.com/u/6257311?v=4)](https://github.com/dennisgon "dennisgon (1 commits)")[![emil-nasso](https://avatars.githubusercontent.com/u/1119706?v=4)](https://github.com/emil-nasso "emil-nasso (1 commits)")[![lukebakken](https://avatars.githubusercontent.com/u/514926?v=4)](https://github.com/lukebakken "lukebakken (1 commits)")

---

Tags

laravelpackagelumenqueuerabbitmqmessage queueAMQPlaravel5Björn Schmittbschmitt

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/thitruongsicom-laravel-amqp/health.svg)

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

###  Alternatives

[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2752.3M7](/packages/bschmitt-laravel-amqp)[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)[nuwber/rabbitevents

The Nuwber RabbitEvents package

120515.8k3](/packages/nuwber-rabbitevents)[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)
