{"id":20910007,"url":"https://github.com/puzzle-org/amqp","last_synced_at":"2025-05-13T07:31:25.850Z","repository":{"id":6893874,"uuid":"55640928","full_name":"puzzle-org/amqp","owner":"puzzle-org","description":"Manage AMQP messages (publishing and consuming)","archived":false,"fork":false,"pushed_at":"2023-03-28T08:48:19.000Z","size":403,"stargazers_count":3,"open_issues_count":7,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-19T03:13:27.980Z","etag":null,"topics":["amqp","asynchronous","library","oop","php","silex","swarrot","worker"],"latest_commit_sha":null,"homepage":"https://puzzle-amqp.readthedocs.io/en/latest/index.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puzzle-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-06T21:13:12.000Z","updated_at":"2023-02-10T14:52:38.000Z","dependencies_parsed_at":"2023-01-13T14:09:35.384Z","dependency_job_id":null,"html_url":"https://github.com/puzzle-org/amqp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle-org%2Famqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle-org%2Famqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle-org%2Famqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle-org%2Famqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puzzle-org","download_url":"https://codeload.github.com/puzzle-org/amqp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225187980,"owners_count":17434980,"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":["amqp","asynchronous","library","oop","php","silex","swarrot","worker"],"created_at":"2024-11-18T14:13:37.476Z","updated_at":"2025-05-13T07:31:25.845Z","avatar_url":"https://github.com/puzzle-org.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Puzzle AMQP  ![PHP \u003e= 8.0](https://img.shields.io/badge/php-%3E%3D%208.0-blue.svg)\n===========\nPHP 5.6 \u0026 7.x users, please use \u003c 5.x versions.\n\nQA\n--\n\n| Service                 | Result |\n|-------------------------| --- |\n| **CI** (PHP 8.3 .. 8.4) | [![CI](https://github.com/puzzle-org/configuration/actions/workflows/ci.yml/badge.svg)](https://github.com/puzzle-org/amqp/actions/workflows/ci.yml)\n| **Packagist**           | [![Latest Stable Version](https://poser.pugx.org/puzzle/amqp/v/stable.png)](https://packagist.org/packages/puzzle/amqp) [![Total Downloads](https://poser.pugx.org/puzzle/amqp/downloads.svg)](https://packagist.org/packages/puzzle/amqp) |\n\nConfiguration\n-------------\n\n```yml\n# amqp.yml\nbroker:\n    host: myRabbit\n    port: 5672\n    login: guest\n    password: guest\n    vhost: /\nglobal:\n    disallowSilentDropping: false\n\n# app.yml\nid: myApp\n```\n\nUsage\n-----\n## Sending a message\n\n```php\n\u003c?php\n\nrequire '../vendor/autoload.php';\n\nuse Puzzle\\Configuration\\Memory;\nuse Puzzle\\AMQP\\Clients\\Pecl;\nuse Puzzle\\AMQP\\Messages\\Message;\n\n$configuration = new Memory(array(\n    'amqp/broker/host' =\u003e 'myRabbit',\n    'amqp/broker/login' =\u003e 'guest',\n    'amqp/broker/password' =\u003e 'guest',\n    'amqp/broker/vhost' =\u003e '/',\n    'app/id' =\u003e 'myApp',\n));\n\n$client = new Pecl($configuration);\n\n$message = new Message('my.routing.key');\n$message-\u003esetJson([\n    'key' =\u003e 'value',\n    'key2' =\u003e 'value2',\n]);\n\n$client-\u003epublish('myExchange', $message);\n```\n## Consuming a message\n\n### Worker declaration :\n```php\n\u003c?php\n\nuse Puzzle\\AMQP\\Consumers;\nuse Puzzle\\AMQP\\Clients;\nuse Puzzle\\AMQP\\Workers\\ProcessorInterfaceAdapter;\nuse Puzzle\\Configuration\\Memory;\n\n$configuration = new Memory(array(\n    'amqp/broker/host' =\u003e 'rabbitmq',\n    'amqp/broker/login' =\u003e 'guest',\n    'amqp/broker/password' =\u003e 'guest',\n    'amqp/broker/vhost' =\u003e '/',\n    'app/id' =\u003e 'myApp',\n));\n\n$consumer = new Consumers\\Simple();\n\n$worker = new ExampleWorker();\n\n$consumer-\u003econsume(\n    new ProcessorInterfaceAdapter($worker),\n    new Clients\\Pecl($configuration),\n    'queue.name'\n);\n```\n### Worker example :\n```php\n\u003c?php\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse Puzzle\\AMQP\\ReadableMessage;\nuse Puzzle\\AMQP\\Workers\\Worker;\n\nclass ExampleWorker implements Worker\n{\n    use LoggerAwareTrait;\n\n    public function __construct()\n    {\n        $this-\u003elogger = new NullLogger();\n    }\n\n    public function process(ReadableMessage $message): void\n    {\n        // your code here\n    }\n}\n```\n\nBC Breaks changelog\n-------------------\n**4.x -\u003e 5.x**\n\n - Drop support for php 5.6 \u0026 7.x\n - Worker now catch Throwable, not only Exceptions\n- Consumer / Worker / WorkerContext signature change\n\n**3.x -\u003e 4.x**\n\n - Chunk management introduced in 3.1 has been refactored and made easier : just use Streamed* bodies and same client as usual \n\n**2.x -\u003e 3.x**\n\n - Message hooks has been removed\n - Raw \u0026 Json implementations of WritableMessage has been replaced by Message + implementations of Body (Text, Json, Binary)\n - Message interface has been renamed into MessageMetadata\n - Some specific features removed from WorkerContext\n - Getter for specific headers removed from MessageAdapter\n - Message InMemory implementation (for unit testing purpose) has been changed\n - MessageAdapter must not be directly constructed anymore, use MessageAdapterFactory instead\n\n**1.x -\u003e 2.x**\n\n - Drop support for Silex 1.x (in favor of Silex 2.x)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzle-org%2Famqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuzzle-org%2Famqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzle-org%2Famqp/lists"}