Skip to content

enl/amqpworkers

Repository files navigation

AMQP Workers library

Latest Version on Packagist Software License Build Status Scrutinizer Code Quality Total Downloads

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.

Features

  • More fluent and flexible interface than original php-amqplib library;
  • Very lazy approach, amqp-related stuff is called only when you call run or produce functions.

Install

composer require enl/amqp-workers

Usage

// 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();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email deadyaga@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages