amqp Wrapper class over AMQP PHP library, gateway pattern implementation

  1. CAMQP Extension
  2. Changelog:
  3. Requirements
  4. Installation
  5. Usage

CAMQP Extension

DoubleGIS company presents Yii extensions for MQ-Servers like RabbitMQ, ApacheMQ or other servers which support AMQP protocol.

The 'CAMQP' is a Yii Framework Plugin that provides a Gateway for MQ-Server interface. Contains all methods to add/edit/delete/read messages/queues/exchanges on the broker.

Allow to work in 'Fake' mode to avoid direct connection to the broker.


  • 1.1 Flags bitmask added, some bugs fixed
  • 1.0 Initial release



  • Unpack all files under your project 'component' folder
  • Include your new extenion into your project main.php configuration file:
'components' => array(
                'amqp' => array(
                    'class' => 'application.components.AMQP.CAMQP',
                    'host'  => ''
  • Enjoy!


To write a message into the MQ-Exchange:

Yii::app()->amqp->exchange('topic')->publish('some message','some.route');

To read a message from MQ-Queue:


To Create an Exchange from the Script:

$ex = Yii::app()->amqp->declareExchange('my_new_exchange');
// now we can use created exchange
$ex->publish('message1', 'some.route');
$ex->publish('message2', 'some.route');
$ex->publish('message3', 'some.route');
$ex->publish('messageN', 'some.route');

To Create a Queue from the Script:

$queue = Yii::app()->amqp->declareQueue('my_new_queue');
// now we can use created queue
while ($message = $queue->get()) {
    // reading all messages

Bind a Queue to an Exchange:

$queue = Yii::app()->amqp->queue('my_new_queue');
$ex = Yii::app()->amqp->queue('my_new_exchange');
$ex->publish('Hello World!', 'routie');
echo $queue->get(); // Hello World!
/* OR */
$queue = Yii::app()->amqp->bindQueueToExchange('my_new_queue', 'my_new_exchange');
echo $queue->get(); // Hello World!
15 5
1 955 downloads
Yii Version: 1.1
License: (not set)
Category: Web Service
Developed by: a.spiridonov
Created on: Nov 25, 2010
Last updated: 12 years ago


show all

Related Extensions