Download the PHP package hzted123/yii2-amqp without Composer
On this page you can find all versions of the php package hzted123/yii2-amqp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-amqp
Yii2 amqp consumer tool
A tool to amqp consumer. It can declare exchange and queue with config. And Keep consumer alive with cronjobs.
This extension is based on this. Thanks webtoucher.
But with a few change:
- consumer setting by queue, not route or exchange
- all exchange and queue setting in config
- add listener-manage controller
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Add the following in your console config:
Add messages interpreter class @app/components/DemoEventInterpreter
with your handlers for different routing keys:
Usage
Just run command
to start all consumers , or like this
Run command
to kill all consumers, when you deploy new code.
Run command
to listen a queue on selected queue.
Also you can create controllers for your needs. Just use for your web controllers class
hzted123\amqp\controllers\AmqpConsoleController
instead of yii\web\Controller
and for your console controllers
class hzted123\amqp\controllers\AmqpConsoleController
instead of yii\console\Controller
. AMQP connection will be
available with property connection
. AMQP channel will be available with property channel
.
Note: The configuration information, starting with version 1.0.2, exchange and route switching position, for multiple routes binding to a queue
All versions of yii2-amqp with dependencies
php Version >=5.3.0
php-amqplib/php-amqplib Version ~2.0
hzted123/yii2-cronjobs Version *