{"id":19584850,"url":"https://github.com/php-amqplib/thumper","last_synced_at":"2025-05-16T13:06:49.204Z","repository":{"id":1138635,"uuid":"1018035","full_name":"php-amqplib/Thumper","owner":"php-amqplib","description":"PHP Library that implements several messaging patterns for RabbitMQ","archived":false,"fork":false,"pushed_at":"2021-12-21T19:46:11.000Z","size":165,"stargazers_count":277,"open_issues_count":8,"forks_count":62,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-16T13:06:47.879Z","etag":null,"topics":[],"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/php-amqplib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-23T18:01:40.000Z","updated_at":"2025-02-07T16:08:41.000Z","dependencies_parsed_at":"2022-08-16T12:15:10.509Z","dependency_job_id":null,"html_url":"https://github.com/php-amqplib/Thumper","commit_stats":null,"previous_names":["videlalvaro/thumper"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-amqplib%2FThumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-amqplib%2FThumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-amqplib%2FThumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-amqplib%2FThumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-amqplib","download_url":"https://codeload.github.com/php-amqplib/Thumper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535829,"owners_count":22087399,"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":[],"created_at":"2024-11-11T07:50:33.254Z","updated_at":"2025-05-16T13:06:49.185Z","avatar_url":"https://github.com/php-amqplib.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thumper\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nThumper is a PHP library that aims to abstract several messaging patterns that can be implemented over RabbitMQ.\n\nInside the _examples_ folder you can see how to implement RPC, parallel processing, simple queue servers and pub/sub.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require php-amqplib/thumper\n```\n\n## About the Examples\n\nEach example has a README.md file that shows how to execute it. All the examples expect that RabbitMQ is running. They have been tested using RabbitMQ 2.1.1\n\nFor example, to publish message to RabbitMQ is as simple as this:\n\n\t\t$producer = new Thumper\\Producer($connection);\n\t\t$producer-\u003esetExchangeOptions(array('name' =\u003e 'hello-exchange', 'type' =\u003e 'direct'));\n\t\t$producer-\u003epublish($argv[1]);\n\nAnd then to consume them on the other side of the wire:\n\n\t\t$myConsumer = function($msg)\n\t\t{\n\t\t  echo $msg, \"\\n\";\n\t\t};\n\n\t\t$consumer = new Thumper\\Consumer($connection);\n\t\t$consumer-\u003esetExchangeOptions(array('name' =\u003e 'hello-exchange', 'type' =\u003e 'direct'));\n\t\t$consumer-\u003esetQueueOptions(array('name' =\u003e 'hello-queue'));\n\t\t$consumer-\u003esetCallback($myConsumer); //myConsumer could be any valid PHP callback\n\t\t$consumer-\u003econsume(5); //5 is the number of messages to consume.\n\n### Queue Server\n\nThis example illustrates how to create a producer that will publish jobs into a queue. Those jobs will be processed later by a consumer –or several of them–.\n\n### RPC\n\nThis example illustrates how to do RPC over RabbitMQ. We have a RPC Client that will send request to a server that returns the number of characters in the provided strings. The server code is inside the _parallel\\_processing_ folder.\n\n### Parallel Processing\n\nThis example is based on the RPC one. In this case it shows how to achieve parallel execution with PHP. Let's say that you have to execute two expensive tasks. One takes 5 seconds and the other 10. Instead of waiting 15 seconds, we can send the requests in parallel and then wait for the replies which should take 10 seconds now –the time of the slowest task–.\n\n### Topic\n\nIn this case we can see how to achieve publish/subscribe with RabbitMQ. The example is about logging. We can log with several levels and subjects and then have consumers that listen to different log levels act accordingly.\n\n### Anonymous Consumers\n\nAlso inside the _topic_ folder there's an anonymous consumer example. The idea here is for those situations when you need to hook up a queue to some exchange to \"spy\" what's going on, but when you quit your program you want that the queue is automatically deleted. We can achieve this using an unnamed queue.\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.\n\n## Disclaimer\n\nThis code is experimental. The idea is to show how easy is to implement such patterns with RabbitMQ and AMQP.\n\n## Credits\n\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/php-amqplib/thumper.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/php-amqplib/Thumper/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/php-amqplib/Thumper.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/php-amqplib/Thumper.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/php-amqplib/thumper.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/php-amqplib/Thumper\n[link-travis]: https://travis-ci.org/php-amqplib/Thumper\n[link-scrutinizer]: https://scrutinizer-ci.com/g/php-amqplib/Thumper/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/php-amqplib/Thumper\n[link-downloads]: https://packagist.org/packages/php-amqplib/thumper\n[link-author]: https://github.com/:author_username\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-amqplib%2Fthumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-amqplib%2Fthumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-amqplib%2Fthumper/lists"}