grigorieff/yii2-amqp

Yii2 component for AMQP

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii-extension

dev-master 2015-08-09 00:36 UTC

This package is not auto-updated.

Last update: 2024-04-27 15:51:35 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist grigorieff/yii2-amqp "*"

or add

"grigorieff/yii2-amqp": "*"

to the require section of your composer.json.

Configuration

Add to your app config:

    'components' => [

        .........

        'amqp' => [
            'class' => grigorieff\amqp\Amqp,
            'host' => 'localhost',
            'port' => '5672',
            'user' => 'guest',
            'password' => 'guest'
        ],

        .........

    ];

Usage

// get AMQP component
$amqp = Yii::$app->amqp;

// declare exchange
$amqp->exchangeDeclare('myExchange','fanout');

// declare queue
$amqp->queueDeclare('myQueue');

// binding queue
$amqp->bindQueueExchange('myQueue','myExchange');

// basic publish message
$amqp->basicPublish($message, $exchange, $routingKey);


......

License

MIT

Requirements

This Yii2 component require PhpAmqpLib