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

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

maksimdimitrov/mdim-amqp-laravel
================================

Laravel service provider for php-amqplib to use RabbitMQ

v1.0.0(4y ago)011MITPHP

Since Oct 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/maksimdimitrov/mdim-amqp-laravel)[ Packagist](https://packagist.org/packages/maksimdimitrov/mdim-amqp-laravel)[ RSS](/packages/maksimdimitrov-mdim-amqp-laravel/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Service Provider for php-amqplib to use with RabbitMQ without Laravel queues.
=====================================================================================

[](#laravel-service-provider-for-php-amqplib-to-use-with-rabbitmq-without-laravel-queues)

It is developed for versions greater than Laravel 5.7

### How to install

[](#how-to-install)

#### Option 1

[](#option-1)

Use `composer require maksimdimitrov/mdim-amqp-laravel`

#### Option 2

[](#option-2)

Add to your composer.json file in "require" section:

`"maksimdimitrov/mdim-amqp-laravel": "dev-master"`

and in "repositories" section:

`{ "type": "vcs", "url": "https://github.com/maksimdimitrov/mdim-amqp-laravel.git" }`

Next: `composer install`

Next step is to run `php artisan vendor:publish --tag=mdim_rabbitmq-config` to publish the config file in config/mdim\_rabbitmq.php Check the available commands `mdim_rabbitmq:publish_hello` and `mdim_rabbitmq:start_consumer 'App\SomeConsumers\SomeJob'` with `php artisan`

### The config in config/mdim\_rabbitmq.php

[](#the-config-in-configmdim_rabbitmqphp)

You can have many connections: default, some-other-rabbitmq-service, etc...

```
return [
    'connections' => [
        'default' => [

            /** optional, it will default to AMQPStreamConnection */
            'connectionClass' => PhpAmqpLib\Connection\AMQPStreamConnection::class,

            'connectionConfig' => [
                [
                    'host' => 'rabbitmq',
                    'port' => '5672',
                    'user' => 'guest',
                    'password' => 'guest',
                ],
            ],

            'connectionOptions' => [],
        ],

        'some-other-rabbitmq-service' => [

            'connectionConfig' => [
                [
                    'host' => 'localhost',
                    'port' => '5672',
                    'user' => 'guest',
                    'password' => 'guest',
                ],
            ],
        ],
    ],
];

```

### How to use

[](#how-to-use)

You need to create a new job class which will act as consumer and hold the callback function when a message is received. The class has to extend `MdimAMQPLaravel\ReceiveJob` and have function handle() implemented, which is the callback function. You can use the dependency container to inject services. You also need to define getConnectionName(), getQueueName() and getConsumerTag(), check AMQP docs for property descriptions getConnectionName() should return name of the connection from config/mdim\_rabbitmq.php e.g. default or some-other-rabbitmq-service

All the static methods in `MdimAMQPLaravel\ReceiveJob` you can rewrite for your consumer needs.

There are two examples ready to run. Check the job class `MdimAMQPLaravel\Examples\HelloJob` which will consume messages after you start it. You can push messages with example command class `MdimAMQPLaravel\Examples\HelloCommand`

Start this example with a command in the console `php artisan mdim_rabbitmq:start_consumer 'MdimAMQPLaravel\Examples\HelloJob'`

Open another console and run a command `php artisan mdim_rabbitmq:publish_hello`

In the first console you should see the received message now.

After you write your job work class with example name `SomeNamespace\SomeClass` you can start it with

`php artisan mdim_rabbitmq:start_consumer 'SomeNamespace\SomeClass'`

Publishing messages can be done without commands, but also from your controller like this:

```

app('mdim_rabbitmq-publisher')
    ->connection('default') // default is the connection name from config file, e.g. default or some-other-rabbitmq-service
    ->queue('some-queue-name', false, true, false, false)
    ->publish('Hello message', ['delivery_mode' => \PhpAmqpLib\Message\AMQPMessage::DELIVERY_MODE_PERSISTENT], '', 'some-queue-name')
    ->close();

```

An example consumer class can be:

```

namespace SomeNamespace;
use MdimAMQPLaravel\ReceiveJob;

class SomeClass extends ReceiveJob
{
    public function handle()
    {
        echo 'message -> ' . $this->msg->body . PHP_EOL;
        $this->msg->delivery_info['channel']->basic_ack($this->msg->delivery_info['delivery_tag']);
    }

    public static function getConnectionName()
    {
        return 'default'; // default is the connection name from config file, e.g. default or some-other-rabbitmq-service
    }

    public static function getQueueName()
    {
        return 'some-queue-name';
    }

    public static function getConsumerTag()
    {
        return '';
    }
}

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

1665d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/003055c4385c5f24777d31733e3ada615c33e598c063ac891cc0c0e7a72ba918?d=identicon)[maksimdimitrov](/maintainers/maksimdimitrov)

---

Top Contributors

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

---

Tags

laravelrabbitmq

### Embed Badge

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

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

###  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)[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)[kunalvarma05/laravel-rabbitmq

Work with RabbitMQ in Laravel.

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

RabbitMQ Broker for Laravel

151.2k](/packages/kontoulis-rabbitmq-laravel)

PHPackages © 2026

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