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

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

deankh/laravel-rabbitmq
=======================

Queuing, Messages exchange, etc

0.1.0(8y ago)0154MITPHPPHP &gt;=7.0

Since May 11Pushed 8y ago1 watchersCompare

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

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

RabbitMQ Queue driver for Laravel/Lumen 5.4+
============================================

[](#rabbitmq-queue-driver-for-laravellumen-54)

Description
-----------

[](#description)

Laravel/Lumen wrapper for RabbitMQ queue (queue - worker) and messaging ( pub - sub). This package uses separate configuration options for the Laravel\\Lumen queue extension, and another implementation for Pub\\Sub.

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

[](#installation)

1. Install this package via composer using:

    `composer require deanhyde/laravel-rabbitmq`
2. Add the Service Provider

    - For Laravel use the `providers` section in the `config/app.php` file `DeanKH\RabbitMQ\ServiceProvider::class,`. Afterwards just publish the configuration using: `php artisan vendor:publish --provider=DeanKH\RabbitMQ\ServiceProvider --tag=config`
    - For Lumen use `$app->register(DeanKH\RabbitMQ\ServiceProvider::class)` in your `bootstrap/app.php` file. After that you will have to create new file in your config folder: `config/messaging.php` and put the sample content from the `messaging-sample.php` file found in: `vendor/kenokokoro/laravel-rabbitmq/config/messaging-sample.php`. Finally just include this configuration file inside your `bootstrap/app.php` file using: `$app->configure('messaging')`
3. Even though the both implementations have different configuration, the connection configuration is same for both

    ```
     QUEUE_DRIVER=rabbitmq
     RABBITMQ_HOST=127.0.0.1
     RABBITMQ_PORT=5672
     RABBITMQ_VHOST=/
     RABBITMQ_LOGIN=guest
     RABBITMQ_PASSWORD=guest

    ```

    List of available environment values can be found in: `vendor/kenokokoro/laravel-rabbitmq/config/queue.php`

    *NOTE: The environment configuration values are used only in the laravel queue extension. For the messaging (pub - sub) it is used different type of configuration*

Usage
-----

[](#usage)

1. Queue ([Laravel official documentation](https://laravel.com/docs/5.4/queues))

    - On Laravel: `Queue::push(App\Jobs\DummyJob::class)`
    - On Lumen you can use the same if you have `$app->withFacades()` added in your `boostrap/app.php` file, or simply `app('queue')->push(App\Jobs\SomeJob::class)`
    - To consume either of this just simply use the Laravel\\Lumen queue worker: `php artisan queue:work`
2. Messaging

    The messaging is using different configuration for queue management (except for the rabbitmq connection). To get in touch for some examples of how the rabbitmq exchange and queue parameters are important check the [RabbitMQ examples](https://www.rabbitmq.com/tutorials/tutorial-three-php.html)

    1. Using dependency injection

        Publishing example:

        ```
