ebichan/silex-amqp-provider

AMQP service provider for the Silex framework.

1.0.1 2016-06-06 12:00 UTC

This package is not auto-updated.

Last update: 2022-08-11 17:22:14 UTC


README

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', '/');