Download the PHP package deankh/laravel-rabbitmq without Composer
On this page you can find all versions of the php package deankh/laravel-rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download deankh/laravel-rabbitmq
More information about deankh/laravel-rabbitmq
Files in deankh/laravel-rabbitmq
Package laravel-rabbitmq
Short Description Queuing, Messages exchange, etc
License MIT
Informations about the package laravel-rabbitmq
RabbitMQ Queue driver for Laravel/Lumen 5.4+
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
-
Install this package via composer using:
composer require deanhyde/laravel-rabbitmq
-
Add the Service Provider
-
For Laravel use the
providers
section in theconfig/app.php
fileDeanKH\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 yourbootstrap/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 themessaging-sample.php
file found in:vendor/kenokokoro/laravel-rabbitmq/config/messaging-sample.php
. Finally just include this configuration file inside yourbootstrap/app.php
file using:$app->configure('messaging')
-
-
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
-
Queue (Laravel official documentation)
- On Laravel:
Queue::push(App\Jobs\DummyJob::class)
- On Lumen you can use the same if you have
$app->withFacades()
added in yourboostrap/app.php
file, or simplyapp('queue')->push(App\Jobs\SomeJob::class)
- To consume either of this just simply use the Laravel\Lumen queue worker:
php artisan queue:work
- On Laravel:
-
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
-
Using dependency injection
Publishing example:
Consuming the publisher example:
- The same can be achieved using
app(DeanKH\RabbitMQ\Messaging\Sub\ConsumeInterface::class)
orapp(DeanKH\RabbitMQ\Messaging\Pub\PublishInterface:class)
-
License
The Laravel\Lumen RabbitMQ package is open-sourced software licensed under the MIT license.
All versions of laravel-rabbitmq with dependencies
php-amqplib/php-amqplib Version 2.6.*
illuminate/contracts Version >=5.4
illuminate/support Version >=5.4
illuminate/queue Version >=5.4
illuminate/database Version >=5.4
illuminate/container Version >=5.4