{This is Fork of anik/amqp package} of php-amqplib wrapper that eases the consumption of RabbitMQ. A painless way of using RabbitMQ
alive2212/laravel-amqp is a Laravel package for {this is fork of anik/amqp package} of php-amqplib wrapper that eases the consumption of rabbitmq. a painless way of using rabbitmq.
It currently has 1 GitHub stars and 62 downloads on Packagist (latest version 1.5.4).
Install it with composer require alive2212/laravel-amqp.
Discover more Laravel packages by alive2212
or browse all Laravel packages to compare alternatives.
Last updated
anik/amqp
anik/amqpanik/amqp is a php-amqplib wrapper that eases the consumption of RabbitMQ. A painless way of using RabbitMQ.
You can use this package with
This package requires the following
The package works with Laravel, Lumen & Laravel zero. Install it via composer.
composer require anik/amqp
The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php providers array:
'providers' => [
/// ...
Anik\Amqp\ServiceProviders\AmqpServiceProvider::class,
]
amqp.php in your config directory with the following command.php artisan vendor:publish --provider="Anik\Amqp\ServiceProviders\AmqpServiceProvider"
bootstrap/app.php file.$app->register(Anik\Amqp\ServiceProviders\AmqpServiceProvider::class);
amqp.php in your config directory by copying it from vendor/anik/amqp/src/config/amqp.php. Don't forget to add $app->configure('amqp'); to your bootstrap/app.php.N.B: For Lumen, you don't need to enable Facade.
config/app.php providers array.'providers' => [
/// ...
Anik\Amqp\ServiceProviders\AmqpServiceProvider::class,
]
amqp.php in your config directory by copying it from vendor/anik/amqp/src/config/amqp.php.<?php
// AmqpManager::publish($msg, $routing, $config);
app('amqp')->publish('Message to direct exchange', 'routing-key', [
'exchange' => [
'type' => 'direct',
'name' => 'direct.exchange',
],
]);
<?php
use Anik\Amqp\ConsumableMessage;
// AmqpManager::consume($consumerHandler, $bindingKey, $config);
app('amqp')->consume(function (ConsumableMessage $message) {
echo $message->getStream() . PHP_EOL;
$message->getDeliveryInfo()->acknowledge();
}, 'routing-key', [
'connection' => 'my-connection-name',
'exchange' => [
'type' => 'direct',
'name' => 'direct.exchange',
],
'queue' => [
'name' => 'direct.exchange.queue',
'declare' => true,
'exclusive' => false,
],
'qos' => [
'enabled' => true,
'qos_prefetch_count' => 5,
],
]);
The full documentation of this package is written in this article
To err is human.