fivelab / amqp
The library for publish/receive messages from broker (RabbitMQ).
Installs: 29 241
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 1
pkg:composer/fivelab/amqp
Requires
- php: ^8.2
Requires (Dev)
- ext-amqp: *
- ext-pcntl: *
- ext-sockets: *
- escapestudios/symfony2-coding-standard: ~3.5
- fivelab/ci-rules: dev-master
- fivelab/transactional: ~2.0
- guzzlehttp/guzzle: ~7.0
- php-amqplib/php-amqplib: ^3.5
- phpmetrics/phpmetrics: ~3.0
- phpstan/phpstan: ~2.1.6
- phpunit/phpunit: ~11.5
- psr/log: *
- symfony/console: ~6.4 | ~7.0 | ~8.0
- symfony/event-dispatcher: ~6.4 | ~7.0 | ~8.0
- symfony/process: ~6.4 | ~7.0 | ~8.0
- symfony/uid: ~6.4 | ~7.0 | ~8.0
Suggests
- ext-amqp: For use amqp extension.
- ext-pcntl: For catch signals and use alarm.
- ext-sockets: For php-amqplib.
- fivelab/transactional: For use transactional layer with this wrapper.
- php-amqplib/php-amqplib: pure PHP driver.
- symfony/console: For configure console commands for run consumer.
- symfony/event-dispatcher: For use events inside consumers.
- symfony/uid: For use UUID message id generator
README
#StandWithUkraineEvent Broker: AMQP
This library for receive events from RabbitMQ and publish messages to AMQP.
Why this?
In many application we must use background processes for process any data or create/update/delete any entries. For this, we use AMQP and RabbitMQ. But, in base implementation of AMQP (PHP Extension and PHPAmqpLib) we have some problems:
- We should connect to RabbitMQ before create the exchange or queue. But in our logic (in controller as an example) we don't need to send message rabbitmq.
- All options for declare exchanges or queues set as flags, and it can be difficult for understanding and typos.
We full isolate this processes in this library for easy send message to exchange and easy receive the messages from queues.
Definitions
All entries of AMQP have a custom definition. Each definition have custom parameters for declare the exchange or queue.
Factories
All entries of AMQP have a factory. It allow to create the real instances only on usage process.
Adapters
We create a library with able to support any adapters for connect to broker. Out-of-the-box supported drivers are:
ext-amqp- composer php-amqplib
Documentation
All documentation stored in /docs/ directory.
Development
For easy development you can use the Docker.
docker compose up
docker compose exec amqp bash
After success run and attach to container you must install vendors:
composer update
Before create the PR or merge into develop, please run next commands for validate code:
./bin/phpunit ./bin/phpcs --config-set show_warnings 0 ./bin/phpcs --standard=vendor/escapestudios/symfony2-coding-standard/Symfony/ src/ ./bin/phpcs --standard=tests/phpcs-ruleset.xml tests/