New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

greenhat616/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages
11

Larablocks Analysis

greenhat616/laravel-amqp works with Laravel 5 to 8 (latest release 2.0.11, Feb 5, 2021), all past end of life (the last on Jan 24, 2023): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5 to 8, past end of life since Jan 24, 2023
  • No release in the last 12 months (last: Feb 5, 2021)
  • 0 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Feb 5, 2021.
  • No releases in the last 12 months.
  • First released: Jun 29, 2016.
  • 1 open issue on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 26, 2026.

Install
composer require greenhat616/laravel-amqp
Latest Version:2.0.11
PHP:>=7.0
Laravel:5 – 8
License:MIT
Last Updated:Apr 3, 2023
Links: GitHub  ·  Packagist
Maintainer: a632079

bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages especially from RabbitMQ

Build Status Latest Stable Version License

Features

  • Advanced queue configuration
  • Add message to queues easily
  • Listen queues with useful options

Installation

Composer

Add the following to your require part within the composer.json:

"bschmitt/laravel-amqp": "2.*" (Laravel >= 5.5)
"bschmitt/laravel-amqp": "1.*" (Laravel < 5.5)
$ php composer update

or

$ php composer require bschmitt/laravel-amqp

Integration

Lumen

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.

return [

    'use' => 'production',

    'properties' => [

        'production' => [
            'host'                => 'localhost',
            'port'                => 5672,
            'username'            => 'username',
            'password'            => 'password',
            'vhost'               => '/',
            'exchange'            => 'amq.topic',
            'exchange_type'       => 'topic',
            'consumer_tag'        => 'consumer',
            'ssl_options'         => [], // See https://secure.php.net/manual/en/context.ssl.php
            'connect_options'     => [], // See https://github.com/php-amqplib/php-amqplib/blob/master/PhpAmqpLib/Connection/AMQPSSLConnection.php
            'queue_properties'    => ['x-ha-policy' => ['S', 'all']],
            'exchange_properties' => [],
            'timeout'             => 0
        ],

    ],

];

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(true, [
    'Bschmitt\Amqp\Facades\Amqp' => 'Amqp',
]);
//...

Laravel

Open config/app.php and add the service provider and alias:

'Bschmitt\Amqp\AmqpServiceProvider',
'Amqp' => 'Bschmitt\Amqp\Facades\Amqp',

Publishing a message

Push message with routing key

    Amqp::publish('routing-key', 'message');

Push message with routing key and create queue

    Amqp::publish('routing-key', 'message' , ['queue' => 'queue-name']);

Push message with routing key and overwrite properties

    Amqp::publish('routing-key', 'message' , ['exchange' => 'amq.direct']);

Consuming messages

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

Amqp::consume('queue-name', function ($message, $resolver) {
    		
   var_dump($message->body);

   $resolver->acknowledge($message);
        
});

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

Publishing a message

\Amqp::publish('', 'message' , [
    'exchange_type' => 'fanout',
    'exchange' => 'amq.fanout',
]);

Consuming messages

\Amqp::consume('', function ($message, $resolver) {
    var_dump($message->body);
    $resolver->acknowledge($message);
}, [
    'routing' => '',
    'exchange' => 'amq.fanout',
    'exchange_type' => 'fanout',
    'queue_force_declare' => true,
    'queue_exclusive' => true,
    'persistent' => true // required if you want to listen forever
]);

Credits

License

This package is open-sourced software licensed under the MIT license

Alternatives to greenhat616/laravel-amqp

lettermint/laravel-rabbitmq

A RabbitMQ queue driver for Laravel with explicit topology, publisher confirms,...

12,855 3
avto-dev/amqp-rabbit-manager

RabbitMQ manager

45,358 2
pushinbr/laravel-rabbit

RabbitMQ client library for Laravel with publishing, consuming, topology, TLS, c...

1,398 1
mookofe/tail

RabbitMQ and PHP client for Laravel and Lumen that allows you to add and listen...

53,476 52

Version History

Version Released PHP Laravel License
2.0.11 >=7.0 >=v5.5.28 MIT
2.0.10 >=7.0 >=v5.5.28 MIT
2.0.9 >=7.0 >=v5.5.28 MIT
2.0.8 >=7.0 >=v5.5.28 MIT
2.0.7 >=7.0 >=v5.5.28 MIT