blackwoodseven / php-lib-amqp-service
Amqp Service.
This package's canonical repository appears to be gone and the package has been frozen as a result.
0.11.0
2017-10-25 13:08 UTC
Requires
- php: >=7.0.0
- php-amqplib/php-amqplib: ^2.6
- pimple/pimple: ^3.0
- psr/log: ~1.0
Requires (Dev)
- phpunit/phpunit: ^5.7
Suggests
- monolog/monolog: ^1.22
This package is not auto-updated.
Last update: 2024-12-07 21:12:02 UTC
README
To install the BlackwoodSeven file library in your project using Composer:
composer require blackwoodseven/php-lib-amqp-service
Usage:
$app->register(new \BlackwoodSeven\AmqpService\ServiceProvider(), [ 'amqp.options' => [ 'product' => 'my_app_id', 'dsn' => 'amqp://user:pass@host:port/vhost', 'exchanges' => [ 'my_exchange_0', 'my_exchange_1' => [ 'type' => 'topic', ], ], 'queues' => [ 'my_queue_1' => [ 'arguments' => [], 'bindings' => [ 'my_exchange_1' => [ 'my_routingkey_1', 'my_routingkey_2', ], ], ], ], ], ]); $default_queue = $app['amqp.queue']; $default_queue->listenOnce(function (\PhpAmqpLib\Message\AMQPMessage $msg) { // do stuff... }); $app['amqp.queues']['another_queue']->listenOnce(function (\PhpAmqpLib\Message\AMQPMessage $msg) { // do stuff... }); $default_exchange = $app['amqp.exchange']; $default_exchange->publish( new \PhpAmqpLib\Message\AMQPMessage('Hello world'), 'my.routing.key' ); $app['amqp.exchanges']['another_exchange']->publish( new \PhpAmqpLib\Message\AMQPMessage('Hello world'), 'my.routing.key' );