PHPackages                             riesenia/cakephp-rabbitmq - 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. riesenia/cakephp-rabbitmq

ActiveCakephp-plugin[Queues &amp; Workers](/categories/queues)

riesenia/cakephp-rabbitmq
=========================

RabbitMQ plugin for CakePHP

v1.0.0(8y ago)32.9k5[2 issues](https://github.com/riesenia/cakephp-rabbitmq/issues)MITPHP

Since Nov 2Pushed 8y ago2 watchersCompare

[ Source](https://github.com/riesenia/cakephp-rabbitmq)[ Packagist](https://packagist.org/packages/riesenia/cakephp-rabbitmq)[ RSS](/packages/riesenia-cakephp-rabbitmq/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

RabbitMQ for CakePHP
====================

[](#rabbitmq-for-cakephp)

[![Build Status](https://camo.githubusercontent.com/d806a0613469ff9f34c0ba9eba6d9ddc67eabfbbc8a188a74e24e43e84db7dbe/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72696573656e69612f63616b657068702d7261626269746d712f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/riesenia/cakephp-rabbitmq)[![Latest Version](https://camo.githubusercontent.com/b1463ee1254a94eec831ce9643a3d23c40a27181b93dd134151475be685a8f95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696573656e69612f63616b657068702d7261626269746d712e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riesenia/cakephp-rabbitmq)[![Total Downloads](https://camo.githubusercontent.com/4d3b3a2330b49e222661365e29c27a00c34e592c5d42c0747c1bf41a40c0069a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72696573656e69612f63616b657068702d7261626269746d712e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riesenia/cakephp-rabbitmq)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This plugin is for CakePHP 3.x and simplifies using [RabbitMQ](https://www.rabbitmq.com/) in CakePHP application.

Installation
------------

[](#installation)

Using composer

```
composer require riesenia/cakephp-rabbitmq
```

Load plugin in *config/bootstrap.php*

```
Plugin::load('RabbitMQ');
```

Usage
-----

[](#usage)

RabbitMQ comes with a built-in shell that listens to defined queues and forwards messages to the callback specified in the configuration.

To start the server run:

```
bin/cake rabbitmq
```

To listen to specified queues only, pass their aliases as arguments:

```
bin/cake rabbitmq server email sms
```

### Send

[](#send)

To send a message to a queue simply use `send` method:

```
use RabbitMQ\CakephpRabbitMQ as MQ;

MQ::send('email', 'this is a message');
```

### Listen

[](#listen)

If you want to run the server inside your own shell, use `listen` method:

```
use RabbitMQ\CakephpRabbitMQ as MQ;

// this will listen to all queues defined in the configuration file
MQ::listen();

// this will listen only to passed queues
MQ::listen(['email']);
```

Configuration
-------------

[](#configuration)

Example configuration (i.e. in your *config/app.php*):

```
    'Riesenia.CakephpRabbitMQ' => [
        'server' => [
            'host' => '127.0.0.1',
            'port' => 5672,
            'user' => 'guest',
            'password' => 'guest'
        ],
        'email' => [
            'cake_command' => 'email send',
            'retry_time' => 15 * 60 * 1000,
            'retry_max' => 3
        ]
    ]
```

Every key in the configuration is an alias for a specific queue. Key `server` is reserved for definition of the RabbitMQ connection.

### Basic Configuration keys

[](#basic-configuration-keys)

Below are just basic configuration keys. For complete configuration see a section below.

- `retry` *(bool)* - retry if operation failed
- `retry_time` *(int)* - retry period (in ms)
- `retry_max` *(int)* - maximum retry times

### Callback

[](#callback)

There are three types of callback available: `callback`, `command` and `cake_command`. **Please specify only one type of callback!** If retry is enabled, the **callback must return a status code** to indicate whether the process was successful or not. **Return 0 if successful**, any other number means fail. **For cake shell methods return true for success** and false otherwise.

#### command

[](#command)

*(string)*

This will execute a defined command. For example a configuration

```
        'command' => 'rm'
```

will execute `rm ` command.

#### cake\_command

[](#cake_command)

*(string)*

This is a shortage for a *bin/cake* command. For example a configuration

```
        'cake_command' => 'email send'
```

will execute `bin/cake email send ` command.

#### callback

[](#callback-1)

*(callable)*

This will call the callback function. For example a configuration

```
        'callback' => [new MyMailer() ,'sendEmail']
```

will call the `sendEmail($message)` on `MyMailer` object. Please notice that **callback function will recevie the raw AMQPMessage**. The message you sent can be accessed using `$message->body`. For more details on PHP callable, see [PHP documentation](http://php.net/manual/en/language.types.callable.php).

### Complete Configuration keys

[](#complete-configuration-keys)

Below are the default values for all configuration keys. Please see the RabbitMQ documentation for more details on each configuration key.

#### server

[](#server)

```
'server' => [
    'host' => 'localhost',
    'port' => 5672,
    'user' => 'guest',
    'password' => 'guest',
    'vhost' => '/',
    'insist' => false,
    'login_method' => 'AMQPLAIN',
    'login_response' => null,
    'locale' => 'en_US',
    'connection_timeout' => 3.0,
    'read_write_timeout' => 3.0,
    'context' => null,
    'keepalive' => false,
    'heartbeat' => 0
 ];
```

#### queue

[](#queue)

```
'' => [
    // Main queue
    'exchange' => [
        'name' => '_exchange',
        'type' => 'direct',
        'passive' => false,
        'durable' => false,
        'auto-delete' => false,
        'internal' => false,
        'no-wait' => false,
        'arguments' => []
    ],
    'queue' => [
        'name' => '_queue',
        'passive' => false,
        'durable' => true,
        'exclusive' => false,
        'auto-delete' => false,
        'no-wait' => false,
        'arguments' => []
    ],
    'routing_key' => '_routing_key',

    // Retry setting
    'retry' => true,
    'retry_time' => 5 * 60 * 1000, // 5 mins
    'retry_max' => 5,

    // Retry queue
    'retry_exchange' => [
        'name' => '_retry_exchange',
        'type' => 'direct',
        'passive' => false,
        'durable' => false,
        'auto-delete' => false,
        'internal' => false,
        'no-wait' => false,
        'arguments' => []
    ],
    'retry_queue' => [
        'name' => '_retry_queue',
        'passive' => false,
        'durable' => true,
        'exclusive' => false,
        'auto-delete' => false,
        'no-wait' => false,
        'arguments' => []
    ],
    'retry_routing_key' => '_retry_routing_key',

    // Basic qos
    'basic_qos' => [
        'prefetch-size' => null,
        'prefetch-count' => 1,
        'global' => null
    ],

    // Basic consume
    'basic_consume' => [
        'consumer-tag' => '',
        'no-local' => false,
        'no-ack' => false,
        'exclusive' => false,
        'no-wait' => false
    ]
]
```

**Notice:** Configuration except `retry_max` cannot be changed after the first run without reseting the queue.

Run the following command to reset the queue:

```
rabbitmqctl stop_app && rabbitmqctl reset && rabbitmqctl start_app
```

**Warning: This will delete all the messages in the rabbitmq**

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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

3110d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40c7ed7cfaebeddae57ac4a376c8f21df56dd2f38821b7ba92ea1312ef8020c8?d=identicon)[riesenia](/maintainers/riesenia)

---

Top Contributors

[![chanpete](https://avatars.githubusercontent.com/u/10811588?v=4)](https://github.com/chanpete "chanpete (40 commits)")[![segy](https://avatars.githubusercontent.com/u/1355459?v=4)](https://github.com/segy "segy (10 commits)")

---

Tags

cakephprabbitmq

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/riesenia-cakephp-rabbitmq/health.svg)

```
[![Health](https://phpackages.com/badges/riesenia-cakephp-rabbitmq/health.svg)](https://phpackages.com/packages/riesenia-cakephp-rabbitmq)
```

###  Alternatives

[php-amqplib/rabbitmq-bundle

Integrates php-amqplib with Symfony &amp; RabbitMq. Formerly emag-tech-labs/rabbitmq-bundle, oldsound/rabbitmq-bundle.

1.3k20.1M64](/packages/php-amqplib-rabbitmq-bundle)[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2752.3M7](/packages/bschmitt-laravel-amqp)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308850.3k14](/packages/dereuromark-cakephp-queue)[php-amqplib/thumper

AMQP Tools

276210.8k7](/packages/php-amqplib-thumper)[videlalvaro/thumper

AMQP Tools

27783.1k3](/packages/videlalvaro-thumper)[mikemadisonweb/yii2-rabbitmq

Wrapper based on php-amqplib to incorporate messaging in your Yii2 application via RabbitMQ. Inspired by RabbitMqBundle for Symfony 2, really awesome package.

74262.1k1](/packages/mikemadisonweb-yii2-rabbitmq)

PHPackages © 2026

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