All this library does is providing more fluent experience with AMQP. Original phpamqplib has very strange approach to its functions declarations.
I decided to create a tiny layer of abstraction which provides a bit more flexible interface:
$consumer = Consumer::factory($connection)
->withQueue(new Queue('consume_from'))
->withWorker($worker)
->run();
That is very short basic setup, Consumer
has much more functions. Read the manual for more detailed description.
- More fluent and flexible interface than original php-amqplib library;
- Very lazy approach, amqp-related stuff is called only when you call
run
orproduce
functions.
composer require enl/amqp-workers
// Create AMQPConnection
$connection = new AMQPLazyConnection();
// We're using static `factory` function only for convenience with fluent interface
$consumer = Consumer::factory($connection)
// set queue definition. all parameters are default
->withQueue(new Queue('consume_from'))
// Worker is an object of WorkerInterface which handles given message body
->withWorker($worker)
// declare and start consuming the queue
->run();
Please see CHANGELOG for more information what has changed recently.
composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.