ebichan/silex-amqp-provider

AMQP service provider for the Silex framework.


Keywords
silex, queue, rabbitmq, AMQP
License
MIT

Documentation

silex-amqp-provider

Amqp service provider for the Silex framework.

This repository is strongly inspired by the work of Vitaliy Chesnokov on his Mongo Silex Provider.

Install via composer

Add in your composer.json the require entry for this library.

{
    "require": {
        "ebichan/silex-amqp-provider": "dev-master"
    }
}

and run composer install (or update) to download all files.

Usage

Service registration

$app->register(new AmqpServiceProvider, array(
    'amqp.connections' => array(
        'default' => array(
            'host' => 'localhost',
            'port' => 5672,
            'username' => 'guest',
            'password' => 'guest',
            'vhost'    => '/'
        )
    ),
));

Connections retrieving

$connections = $app['amqp'];
$defaultConnection = $connections['default']; 

Creating amqp connection via factory

$amqpFactory = $app['amqp.factory'];
$customConnection = $amqpFactory('localhost', 5672, 'guest', 'guest', '/');