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

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

mmanazar/laravel-amqp
=====================

AMQP wrapper for Laravel and Lumen to publish and consume messages in bulk

1.2.2(9y ago)016MITPHPPHP &gt;=5.5.9

Since Jun 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mmanazar/laravel-amqp)[ Packagist](https://packagist.org/packages/mmanazar/laravel-amqp)[ RSS](/packages/mmanazar-laravel-amqp/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)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": "1.*"
```

```
$ php composer update
```

or

```
$ php composer require bschmitt/laravel-amqp

```

Integration
-----------

[](#integration)

### Lumen and Laravel Both

[](#lumen-and-laravel-both)

Create a **config** folder in the root directory of your Lumen application and copy the content from **vendor/bschmitt/laravel-amqp/config/amqp.php** to **config/amqp.php**.

Adjust the properties to your needs in here or .env file

```
return [

    'use' => 'production',

    'properties' => [

        'production' => [
            'host'                => '',
            'port'                => '',
            'username'            => '',
            'password'            => '',
            'vhost'               => '/',
            'connect_options'     => [],
            'ssl_options'         => [],

            'exchange'              => 'amq.topic',
            'exchange_type'         => 'topic',
            'exchange_passive'      => false,
            'exchange_durable'      => true,
            'exchange_auto_delete'  => false,
            'exchange_internal'     => false,
            'exchange_nowait'       => false,
            'exchange_properties'   => [],

            'queue_force_declare'   => false,
            'queue_passive'         => false,
            'queue_durable'         => true,
            'queue_exclusive'       => false,
            'queue_auto_delete'     => false,
            'queue_nowait'          => false,
            'queue_properties'      => ['x-ha-policy' => ['S', 'all']],

            'consumer_tag'      => '',
            'consumer_no_local'   => false,
            'consumer_no_ack'     => true,
            'consumer_exclusive'  => false,
            'consumer_nowait'     => false,
            'timeout'             => 0,
            'persistent'          => true,
        ],

    ],

];
```

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();
class_alias(\Illuminate\Support\Facades\App::class, 'App');
//...
```

### 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']);
```

### Push bulk messages with routing key

[](#push-bulk-messages-with-routing-key)

```
    Amqp::publish('routing-key', ['message1', 'message2', ......], a);
```

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);
}, [
    '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

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.4% 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 ~85 days

Total

2

Last Release

3469d ago

### Community

Maintainers

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

---

Top Contributors

[![bschmitt](https://avatars.githubusercontent.com/u/239644?v=4)](https://github.com/bschmitt "bschmitt (29 commits)")[![SpaceK33z](https://avatars.githubusercontent.com/u/533616?v=4)](https://github.com/SpaceK33z "SpaceK33z (4 commits)")[![junaidnasir](https://avatars.githubusercontent.com/u/10703810?v=4)](https://github.com/junaidnasir "junaidnasir (3 commits)")[![ni-bschmitt](https://avatars.githubusercontent.com/u/58559970?v=4)](https://github.com/ni-bschmitt "ni-bschmitt (3 commits)")[![hertzigger](https://avatars.githubusercontent.com/u/4991108?v=4)](https://github.com/hertzigger "hertzigger (2 commits)")[![mmanazar](https://avatars.githubusercontent.com/u/3105778?v=4)](https://github.com/mmanazar "mmanazar (1 commits)")[![AidasK](https://avatars.githubusercontent.com/u/2088484?v=4)](https://github.com/AidasK "AidasK (1 commits)")

---

Tags

laravelpackagelumenqueuerabbitmqmessage queueAMQPlaravel5Björn Schmittbschmitt

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/mmanazar-laravel-amqp/health.svg)](https://phpackages.com/packages/mmanazar-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.3k](/packages/mookofe-tail)[nuwber/rabbitevents

The Nuwber RabbitEvents package

120510.8k2](/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

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

PHPackages © 2026

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