{"id":15067091,"url":"https://github.com/du-disk/laravel-amqp-delay-message","last_synced_at":"2026-01-02T14:48:52.701Z","repository":{"id":63985436,"uuid":"572307321","full_name":"du-disk/laravel-amqp-delay-message","owner":"du-disk","description":"AMQP wrapper for Laravel and Lumen to publish and consume messages","archived":false,"fork":false,"pushed_at":"2022-11-30T01:43:39.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T19:17:17.805Z","etag":null,"topics":["lumen","php8","rabbitmq","rabbitmq-delay-message"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/du-disk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-30T01:37:51.000Z","updated_at":"2023-07-29T00:46:02.000Z","dependencies_parsed_at":"2022-11-30T07:46:08.650Z","dependency_job_id":null,"html_url":"https://github.com/du-disk/laravel-amqp-delay-message","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/du-disk%2Flaravel-amqp-delay-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/du-disk%2Flaravel-amqp-delay-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/du-disk%2Flaravel-amqp-delay-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/du-disk%2Flaravel-amqp-delay-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/du-disk","download_url":"https://codeload.github.com/du-disk/laravel-amqp-delay-message/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822310,"owners_count":20353498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lumen","php8","rabbitmq","rabbitmq-delay-message"],"created_at":"2024-09-25T01:16:24.178Z","updated_at":"2026-01-02T14:48:52.669Z","avatar_url":"https://github.com/du-disk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# du-disk/laravel-amqp-delay-message\nAMQP wrapper for Laravel and Lumen to publish and consume messages especially from RabbitMQ\n\n[![Build Status](https://travis-ci.org/du-disk/laravel-amqp-delay-message.svg?branch=master)](https://travis-ci.org/du-disk/laravel-amqp-delay-message)\n[![Latest Stable Version](https://poser.pugx.org/du-disk/laravel-amqp-delay-message/v/stable.svg)](https://packagist.org/packages/du-disk/laravel-amqp-delay-message)\n[![License](https://poser.pugx.org/du-disk/laravel-amqp-delay-message/license.svg)](https://packagist.org/packages/du-disk/laravel-amqp-delay-message)\n\n## Features\n  - Advanced queue configuration\n  - Add message to queues easily\n  - Listen queues with useful options\n  - Delay Message with x-delay headers\n\n## Installation\n\n### Composer\n\nAdd the following to your require part within the composer.json: \n\n```js\n\"du-disk/laravel-amqp-delay-message\": \"2.*\" (Laravel \u003e= 5.5)\n\"du-disk/laravel-amqp-delay-message\": \"1.*\" (Laravel \u003c 5.5)\n```\n```batch\n$ php composer update\n```\n\nor\n\n```\n$ php composer require du-disk/laravel-amqp-delay-message\n```\n\n## Integration\n\n### Lumen\n\nCreate a **config** folder in the root directory of your Lumen application and copy the content\nfrom **vendor/du-disk/laravel-amqp-delay-message/config/amqp.php** to **config/amqp.php**.\n\nAdjust the properties to your needs.\n\n```php\nreturn [\n\n    'use' =\u003e 'production',\n\n    'properties' =\u003e [\n\n        'production' =\u003e [\n            'host'                =\u003e 'localhost',\n            'port'                =\u003e 5672,\n            'username'            =\u003e 'username',\n            'password'            =\u003e 'password',\n            'vhost'               =\u003e '/',\n            'exchange'            =\u003e 'amq.topic',\n            'exchange_type'       =\u003e 'topic',\n            'consumer_tag'        =\u003e 'consumer',\n            'ssl_options'         =\u003e [], // See https://secure.php.net/manual/en/context.ssl.php\n            'connect_options'     =\u003e [], // See https://github.com/php-amqplib/php-amqplib/blob/master/PhpAmqpLib/Connection/AMQPSSLConnection.php\n            'queue_properties'    =\u003e ['x-ha-policy' =\u003e ['S', 'all']],\n            'exchange_properties' =\u003e [],\n            'timeout'             =\u003e 0\n        ],\n\n    ],\n\n];\n```\n\nRegister the Lumen Service Provider in **bootstrap/app.php**:\n\n```php\n/*\n|--------------------------------------------------------------------------\n| Register Service Providers\n|--------------------------------------------------------------------------\n*/\n\n//...\n\n$app-\u003econfigure('amqp');\n$app-\u003eregister(Brodud\\Amqp\\LumenServiceProvider::class);\n\n//...\n```\n\nAdd Facade Support for Lumen 5.2+\n\n```php\n//...\n$app-\u003ewithFacades(true, [\n    'Brodud\\Amqp\\Facades\\Amqp' =\u003e 'Amqp',\n]);\n//...\n```\n\n\n### Laravel\n\nOpen **config/app.php** and add the service provider and alias:\n\n```php\n'Brodud\\Amqp\\AmqpServiceProvider',\n```\n\n```php\n'Amqp' =\u003e 'Brodud\\Amqp\\Facades\\Amqp',\n```\n\n\n## Publishing a message\n\n### Push message with routing key\n\n```php\n    Amqp::publish('routing-key', 'message');\n```\n\n### Push message with routing key and create queue\n\n```php\t\n    Amqp::publish('routing-key', 'message' , ['queue' =\u003e 'queue-name']);\n```\n\n### Push message with routing key and overwrite properties\n\n```php\t\n    Amqp::publish('routing-key', 'message' , ['exchange' =\u003e 'amq.direct']);\n```\n\n\n## Consuming messages\n\n### Consume messages, acknowledge and stop when no message is left\n\n```php\nAmqp::consume('queue-name', function ($message, $resolver) {\n    \t\t\n   var_dump($message-\u003ebody);\n\n   $resolver-\u003eacknowledge($message);\n\n   $resolver-\u003estopWhenProcessed();\n        \n});\n```\n\n### Consume messages forever\n\n```php\nAmqp::consume('queue-name', function ($message, $resolver) {\n    \t\t\n   var_dump($message-\u003ebody);\n\n   $resolver-\u003eacknowledge($message);\n        \n});\n```\n\n### Consume messages, with custom settings\n\n```php\nAmqp::consume('queue-name', function ($message, $resolver) {\n    \t\t\n   var_dump($message-\u003ebody);\n\n   $resolver-\u003eacknowledge($message);\n      \n}, [\n\t'timeout' =\u003e 2,\n\t'vhost'   =\u003e 'vhost3'\n]);\n```\n\n## Fanout example\n\n### Publishing a message\n\n```php\n\\Amqp::publish('', 'message' , [\n    'exchange_type' =\u003e 'fanout',\n    'exchange' =\u003e 'amq.fanout',\n]);\n```\n\n### Consuming messages\n\n```php\n\\Amqp::consume('', function ($message, $resolver) {\n    var_dump($message-\u003ebody);\n    $resolver-\u003eacknowledge($message);\n}, [\n    'routing' =\u003e '',\n    'exchange' =\u003e 'amq.fanout',\n    'exchange_type' =\u003e 'fanout',\n    'queue_force_declare' =\u003e true,\n    'queue_exclusive' =\u003e true,\n    'persistent' =\u003e true // required if you want to listen forever\n]);\n```\n\n## Credits\n\n* Some concepts were used from https://github.com/mookofe/tail\n\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdu-disk%2Flaravel-amqp-delay-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdu-disk%2Flaravel-amqp-delay-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdu-disk%2Flaravel-amqp-delay-message/lists"}