PHPackages                             kontoulis/rabbit-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. kontoulis/rabbit-manager

ActiveLibrary[Queues &amp; Workers](/categories/queues)

kontoulis/rabbit-manager
========================

Standalone RabbitMQ Command line Manager

v1.0.1(10y ago)452[2 issues](https://github.com/kontoulis/rabbit-manager/issues)MITPHP

Since Oct 3Pushed 10y ago2 watchersCompare

[ Source](https://github.com/kontoulis/rabbit-manager)[ Packagist](https://packagist.org/packages/kontoulis/rabbit-manager)[ RSS](/packages/kontoulis-rabbit-manager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (3)Used By (0)

Rabbit Manager (Standalone)
===========================

[](#rabbit-manager-standalone)

[![Latest Stable Version](https://camo.githubusercontent.com/8c55fc0d399b046351a582a82e86c2cf9bcaf608d9a79bab6aa9273b2a69e073/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6e746f756c69732f7261626269742d6d616e616765722f762f737461626c65)](https://packagist.org/packages/kontoulis/rabbit-manager)[![Latest Unstable Version](https://camo.githubusercontent.com/bbf199189482e182cd8854f22f6b00411780f3420c524b46a98e05862f6d7439/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6e746f756c69732f7261626269742d6d616e616765722f762f756e737461626c65)](https://packagist.org/packages/kontoulis/rabbit-manager)[![License](https://camo.githubusercontent.com/584f5d31240a7b9b359c508d0e41689b45833273ed66970afe63d76d9b799132/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6e746f756c69732f7261626269742d6d616e616765722f6c6963656e7365)](https://packagist.org/packages/kontoulis/rabbit-manager)

There is also a separate [Laravel 5.1 package](https://github.com/kontoulis/rabbitmq-laravel)

Rabbit Manager is a standalone php package to easily manage RabbitMQ

- Built-in command line tools. Simple commands to add/receive messages to/from RabbitMQ
- Install as Standalone, or add it to your own project
- Built in Message Handler and Broker

Install with composer
---------------------

[](#install-with-composer)

```
$ composer require kontouis/rabbit-manager
```

Or use it as standalone
-----------------------

[](#or-use-it-as-standalone)

```
$ git clone https://github.com/kontoulis/rabbit-manager
$ cd rabbit-manager
$ sudo composer update
```

Add bin/rabbit-manager to /usr/local/bin

```
$ sudo ln -s /full/path/to/project/bin/rabbit-manager /usr/local/bin/rabbit-manager
```

Use the default commands or create your own based on those.

Dependencies
------------

[](#dependencies)

- A running instance of [RabbitMQ](https://www.rabbitmq.com) of course

Testing
-------

[](#testing)

Don't forget to run the tests!

```
$ vendor/bin/phpunit
```

Usage
-----

[](#usage)

There are two types of Jobs. One to add messages to a queue and one to listen to that queue.

### Command Line

[](#command-line)

> You can build your own commands based on the ones already defined in the package and then adding them in src/manager.php

```
    $application->addCommands(
    	array(
    		new RabbitManager\Commands\QueueAddCommand,
    		new RabbitManager\Commands\QueueListenCommand,
    		new RabbitManager\Commands\YourCustomCommand,
    	)
    );
```

The package includes 2 basic Commands You can run those from command line, or even add them to [supervisor](http://supervisord.org/index.html) as workers for as many instances you need

- queue:add -&gt; Adds a message to the specified queue

```
$ rabbit-manager queue:add [queueName] [message]

```

- queue:listen -&gt; Consumes the messages from a queue

```
$ rabbit-manager queue:listen [queueName]

```

### As a library

[](#as-a-library)

You can use the package as a library by creating your own CustomHandler and Broker. (However you can use broker as a four-liner to add a message to queue)

- Adding messages to a queue

```
use RabbitManager\Libs\Broker;
use RabbitManager\Libs\Message;

// Your Class and Methods

public function publishMessage($message , $queueName = "Default")
{
    $broker = new Broker(AMPQ_HOST, AMPQ_PORT, AMPQ_USER, AMPQ_PASSWORD , AMPQ_VHOST);
    /* Makes the AMPQ message */
    $msg = new Message($queueName, ["message" => $message]);

    /* Sends the message */
    $broker->sendMessage($msg);

    $output->writeln('Successfully submitted in queue');
}
```

- Consuming the queue : To consume a queue you probabbly need a script to run from the command line, or a script that can run until the queue is empty. A good practice is to have a script just to listen to the Queue and a Handler to do the job with every received message. You can add that file as a worker to the supervisor or just run it as it is. You could also do all that in the same file.

```
use RabbitManager\Libs\Broker;

public function listenToQueue($queueName = "Default" )
// Listening to queue
  $broker = new Broker();
  // Here you tell the broker which handler to call in order to parse the message
  // Use a fully qualified Namespace.
  // The broker will call the tryProcessing() method of the specified Handler
  // for every message received from the queue.
  // The handler in the package is named DefaultHandler
  // Make your own handlers according to your needs
  $broker->listenToQueue(
  	$queueName,
  	array(
  		"\\RabbitManager\\Handlers\\" . $queueName . "Handler"
  	)
  );
```

```
use RabbitManager\Libs\Handler;
use RabbitManager\Libs\Message;

class TheNameOfTheQueue extends Handler
{

	/**
	 * Tries to process the incoming message.
	 * @param Message $msg
	 * @return int One of the possible return values defined as Handler
	 * constants.
	 */
	public function tryProcessing(Message $msg)
	{
	  // TODO : Check, modify or validate the message.
	  // If the message is OK, process it
		return $this->handleSuccess($msg->getAMQPMessage()->body);

	}

	/**
	 * @param $msg
	 * @return int
	 */
	protected function handleSuccess($msg)
	{
	  // TODO : Do the processing. Store something in the db,
	  // Send a notification or eanything you are supossed to do with the received message
		echo $msg . "\n";

    // Returns and integer to the Broker, and the broker continues accordingly.
    // For a full list of return codes see the section bellow
		return Handler::RV_SUCCEED_CONTINUE;
	}
}
```

### Handler return values

[](#handler-return-values)

These return values will tell the broker what to do after you process a message

```
  /**
	 * Pass this message and proceed with the next
	 */
	const RV_PASS = 1;
	/**
	 * Continue and ignore the failed message
	 */
	const RV_FAILED_CONTINUE = 10;
	/**
	 * We failed to do our job with this message (e.g. failed to store it in the database),
	 * Force exit
	 */
	const RV_FAILED_STOP = 11;
	/**
	 * We failed to do our job with this message (e.g. failed to store it in the database),
	 * put it again in the queue
	 */
	const RV_FAILED_REQUEUE = 12;
	/**
	 * Keep listening to the queue after successfully parsing the message
	 */
	const RV_SUCCEED_CONTINUE = 20;
	/**
	 *  Force stop listening after successfully parsing a message
	 */
	const RV_SUCCEED_STOP = 21;
	/**
	 *
	 */
	const RV_SUCCEED = Handler::RV_SUCCEED_CONTINUE;
	/**
	 *
	 */
	const RV_FAILED = Handler::RV_FAILED_CONTINUE;
	/**
	 *
	 */
	const RV_ACK = Handler::RV_SUCCEED;
	/**
	 *
	 */
	const RV_NACK = Handler::RV_FAILED_STOP;
```

### Version

[](#version)

1.0.1

Feel free to give some feedback or ask any questions

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3926d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/31dcb4fd58402de973ea2f3f49187cfbe2d1752b262e89b51479f2e10cc27235?d=identicon)[kontoulis](/maintainers/kontoulis)

---

Top Contributors

[![kontoulis](https://avatars.githubusercontent.com/u/6674486?v=4)](https://github.com/kontoulis "kontoulis (12 commits)")

---

Tags

rabbitmq

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kontoulis-rabbit-manager/health.svg)

```
[![Health](https://phpackages.com/badges/kontoulis-rabbit-manager/health.svg)](https://phpackages.com/packages/kontoulis-rabbit-manager)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54743.1k4](/packages/jolicode-castor)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
