grigorieff / yii2-amqp
Yii2 component for AMQP
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii-extension
Requires
- videlalvaro/php-amqplib: 2.5.*
This package is not auto-updated.
Last update: 2025-03-29 20:44:31 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