{"id":37007261,"url":"https://github.com/php-mq/protocol","last_synced_at":"2026-01-14T00:46:39.009Z","repository":{"id":57039853,"uuid":"98747225","full_name":"php-mq/protocol","owner":"php-mq","description":"The PHPMQ message protocol","archived":false,"fork":false,"pushed_at":"2018-01-01T23:54:07.000Z","size":36,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T01:35:21.433Z","etag":null,"topics":["message-queue","protocol"],"latest_commit_sha":null,"homepage":null,"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/php-mq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-29T17:04:39.000Z","updated_at":"2017-07-29T19:05:40.000Z","dependencies_parsed_at":"2022-08-23T23:30:36.283Z","dependency_job_id":null,"html_url":"https://github.com/php-mq/protocol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/php-mq/protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mq%2Fprotocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mq%2Fprotocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mq%2Fprotocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mq%2Fprotocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-mq","download_url":"https://codeload.github.com/php-mq/protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-mq%2Fprotocol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["message-queue","protocol"],"created_at":"2026-01-14T00:46:38.256Z","updated_at":"2026-01-14T00:46:39.001Z","avatar_url":"https://github.com/php-mq.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/php-mq/protocol.svg?branch=master)](https://travis-ci.org/php-mq/protocol)\n[![Latest Stable Version](https://poser.pugx.org/php-mq/protocol/v/stable)](https://packagist.org/packages/php-mq/protocol) \n[![Total Downloads](https://poser.pugx.org/php-mq/protocol/downloads)](https://packagist.org/packages/php-mq/protocol) \n[![Coverage Status](https://coveralls.io/repos/github/php-mq/protocol/badge.svg?branch=master)](https://coveralls.io/github/php-mq/protocol?branch=master)\n\n# Protocol\n\n## Description\n\nThe PHPMQ message protocol\n\n## Installation\n\n```bash\ncomposer require php-mq/protocol\n```\n\n## Usage\n\n---\n\n## Message headers\n\nEach message sent from a client to the endpoint must have a leading header line which defines:\n\n* A flag that identifies the line as message header \n* A number that identifies the version of the message protocol \n* The type of the message (see [message types](#message-types)) (3 bytes)\n* The number of the following packages (see [packet types](#packet-types))\n\nExample:\n\n```\nH0100102\n\nmeans:\n\nPACKET-ID | VERSION | MSG-TYPE | PACKAGE COUNT\n        H |      01 |      001 |            02 \n```\n \nSo a header always has a length of 8 byte.\n \n## Message types\n\n* `001` - Client sends a message (client to server)\n* `002` - Client wants to consume messages (consume request)\n* `003` - Server dispatches a message (server to client)\n* `004` - Client acknowledges a message (acknowledgement)\n* `005` - Client wants to re-queue a message (pop from queue, append to queue)\n* `006` - Client sends a dead letter for a message (remove message from queue)\n\n## Packet headers\n\nEach data package in a message is preceded by a package header with defines:\n \n* A flag that identifies the line as package header\n* A number that identifies the package type\n* The length of the following package content\n\nExample:\n\n```\nP01000000000000000000000000000000256\n\nmeans:\n\nPACKET-ID | PKG-TYPE | CONTENT-LENGTH (as int)\n        P |       01 |                     256\n```\n\nSo a package header always has a length of 32 byte.\n\n**Please note:** The content length has a length of 32 bytes and is filled up with zeros.\n\n## Packet types\n\n### All\n\n| PKG-Type | Meaning                            |\n|---------:|------------------------------------|\n| 01       |Queue name                          |\n| 02       |Message content                     |\n| 03       |Message ID                          |\n| 04       |Count of message for consumption    |\n| 05       |Time to live of message (TTL)       |\n\n---\n\n### For messages from client to endpoint \n\n* `01` - Queue name\n* `02` - Message content\n* `05` - Message TTL\n\n### For messages from endpoint to client\n\n* `01` - Queue name\n* `02` - Message content\n* `03` - Message ID\n* `05` - Message TTL\n\n### For Consumption\n\n* `01` - Queue name\n* `04` - Count of messages the client wants to consume from the queue\n\n### For message acknowledgment\n\n* `01` - Queue name\n* `03` - Message ID\n\n### For message re-queue\n\n* `01` - Queue name\n* `03` - Message ID\n* `05` - Message TTL\n\n### For dead letter\n\n* `01` - Queue name\n* `03` - Message ID\n\n---\n\n## Full message examples\n\n### Send a message\n\nClient sends a new message with content \"Hello World\" for queue \"Foo\" to server with a TTL of 3600 seconds.\n\n```\nH0100103\nP0100000000000000000000000000003\nFoo\nP0200000000000000000000000000011\nHello World\nP0500000000000000000000000000004\n3600\n```\n\n### Consume messages\n\nClient wants to consume 5 messages from queue \"Foo\".\n\n```\nH0100202\nP0100000000000000000000000000003\nFoo\nP0400000000000000000000000000001\n5\n```\n\n### Dispatch a message\n\nServer sends the message above to the client 300 seconds later.\n\n```\nH0100304\nP0100000000000000000000000000003\nFoo\nP0200000000000000000000000000011\nHello World\nP0300000000000000000000000000032\nd7e7f68761d34838494b233148b5486c\nP0500000000000000000000000000004\n3300\n```\n\n**Note:** TTL was reduced to 3300 seconds.\n\n### Acknowledge a message\n\nClient acknowledges the consumed message with ID `d7e7f68761d34838494b233148b5486c`.\n\n```\nH0100402\nP0100000000000000000000000000003\nFoo\nP0300000000000000000000000000032\nd7e7f68761d34838494b233148b5486c\n```\n\n### Re-queue a message\n\nClient wants the message to be re-queued at the end of the queue, with a new TTL of 3600 seconds.\n\n```\nH0100503\nP0100000000000000000000000000003\nFoo\nP0300000000000000000000000000032\nd7e7f68761d34838494b233148b5486c\nP0500000000000000000000000000004\n3600\n```\n\n### Send a dead letter\n\nClient wants the message to be removed from queue, regardless its TTL\n\n```\nH0100602\nP0100000000000000000000000000003\nFoo\nP0300000000000000000000000000032\nd7e7f68761d34838494b233148b5486c\n```\n\n---\n\n## Contributing\n\nContributions are welcome and will be fully credited. Please see the [contribution guide](.github/CONTRIBUTING.md) for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-mq%2Fprotocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-mq%2Fprotocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-mq%2Fprotocol/lists"}