PHP Classes

RabbitMQ Manager: Manage exchanges, queues messages in RabbitMQ

Recommend this page to a friend!
  Info   View files Example   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 120 All time: 9,444 This week: 177Up
Version License PHP version Categories
rabbitmqmanager 1.0.0The PHP License5PHP 5, Web services
Description 

Author

This package can manage exchanges, queues, and messages in RabbitMQ.

It can connect to a RabbitMQ server and perform several types of operations with exchanges.

Currently it can retrieve the list of available exchanges, create a new exchange, delete an exchange, publish a message, get queues and queues details.

Innovation Award
PHP Programming Innovation award nominee
September 2017
Number 6
RabbitMQ is a well known message queuing system. Like other similar systems it provides means to store published messages until they are consumed by applications that need to process them.

This package can be used to manage queues stored on a RabbitMQ system by executing the basic operations to create, list, update and delete queues.

Manuel Lemos
Picture of MERAJ AHMAD SIDDIQUI
  Performance   Level  
Name: MERAJ AHMAD SIDDIQUI is available for providing paid consulting. Contact MERAJ AHMAD SIDDIQUI .
Classes: 2 packages by
Country: India India
Age: 28
All time rank: 3657252 in India India
Week rank: 569 Up48 in India India Up
Innovation award
Innovation award
Nominee: 2x

Example

<?php

require dirname(__dir__) . "/vendor/autoload.php";

$configuration_file = dirname(__FILE__)."/config.json";
$configuration = json_decode(file_get_contents($configuration_file), true);

use
RabbitMQManager\Config;
use
RabbitMQManager\Exchange;
/**
 * Set configuration of RabbitMQ connection
 */
Config::init($configuration);

/**
 * This will create an object of exchange to be used for operation on exchange
 */
$exchange = new Exchange();

/**
 * Get List of all exchanges available
 */
$list = $exchange->getExhangeList();
var_dump($list);

/**
 * Create new exchange
 */
$new_exchange_name = "ads";
$new_exchange_args = [
   
"type" => "direct", //Compulsary
   
"auto_delete" => false,
   
"durable" => true,
   
"internal" => false,
   
"arguments" => [
       
"author" => "meraj",
       
"source" => "lib",
    ],
];

$result = $exchange->createExchange($new_exchange_name, $new_exchange_args);
var_dump($result);

/**
 * Publishing Message to an exchange
 */
$publish_exchange_name = "ads";
$publish_data = [
   
"properties" => [

    ],
   
"routing_key" => "ads_test",
   
"payload" => "Thsi is the payload to be published",
   
"payload_encoding" => "string", //string, base64
];

$published = $exchange->publishMessage($publish_exchange_name, $publish_data);
var_dump($published);

/**
 * Deleting any exchange, delete method takes three arguments
 */
//exchange name to delete
$exchange_name = "ads";
//optional ---- default false, If true it will delete it even if its in use
$delete_forcefully = false;
//optional ---- default as provided in configuration
$vhost = "something";

$deleted = $exchange->deleteExchange($exchange_name, $delete_forcefully, $vhost);
var_dump($deleted);


  Files folder image Files  
File Role Description
Files folder imageexample (4 files)
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file config.json Data Auxiliary data
  Accessible without login Plain text file Connecton.php Example Example script
  Accessible without login Plain text file Exchange.php Example Example script
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageRabbitMQManager (5 files)

  Files folder image Files  /  src  /  RabbitMQManager  
File Role Description
  Plain text file Config.php Class Class source
  Plain text file Connection.php Class Class source
  Plain text file Exchange.php Class Class source
  Plain text file Queues.php Class Class source
  Plain text file Request.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:120
This week:0
All time:9,444
This week:177Up