PHPackages                             cbm/yii2-mailqueue - 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. cbm/yii2-mailqueue

ActiveLibrary

cbm/yii2-mailqueue
==================

Message queue for emails extension for the Yii framework

0.1.0(11y ago)1484MITPHP

Since Apr 1Pushed 11y ago1 watchersCompare

[ Source](https://github.com/chrisb88/yii2-mailqueue)[ Packagist](https://packagist.org/packages/cbm/yii2-mailqueue)[ RSS](/packages/cbm-yii2-mailqueue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Message queue for emails extension for Yii 2
============================================

[](#message-queue-for-emails-extension-for-yii-2)

This extension provides an email solution via message queueing for Yii 2. It comes ready for [RabbitMQ](https://www.rabbitmq.com/). For other MQs you can provide your own "mqMessageClass" (see below) as long as it implements the QueueMessageInterface. You need of course a message queue like [RabbitMQ](https://www.rabbitmq.com/) installed.

**Be aware that this extension is stable but not ready for production yet.**

Please submit issue reports and pull requests to .

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist cbm/yii2-mailqueue

```

or add

```
"cbm/yii2-mailqueue": "*"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

Sample configuration:

```
return [
    //....
    'components' => [
        // This is the message queue mailer config, it substitutes the original mailer config
        'mailer' => [
            'class' => 'cbm\mailqueue\QueueMailer',
            'mqMessageClass' => 'cbm\mailqueue\RabbitMessage',
            'mqConfig' => [
                'host' => 'localhost',
                'port' => 5672,
                'user' => 'guest',
                'password' => 'guest',
                'queue' => 'email_task',
                'publishRoutingKey' => 'email_task',
            ],
        ],
        // You also need the original yii swift mailer but with a different name
        'emailMailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            //....
        ],
    ],
];
```

You can then send an email to the queue as follows (no change to the original implementation):

```
Yii::$app->mailer->compose('contact/html')
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->send();
```

Don't forget to rename your original yii swift mailer to "emailMailer". It is still needed to really send the emails.

Get the email consumer running
------------------------------

[](#get-the-email-consumer-running)

Copy the file console/controller under your application console/controller (or where ever your console commands are) and run

```
yii email-task

```

The consumer will then listen to email messages and send them using the original yii swift mailer.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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

4065d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ec7a6f84fe64945c21c0f68ec45edb638acff53e695460694c86f3ad655b8c2?d=identicon)[chrisb88](/maintainers/chrisb88)

---

Top Contributors

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

---

Tags

yii2mailqueue

### Embed Badge

![Health badge](/badges/cbm-yii2-mailqueue/health.svg)

```
[![Health](https://phpackages.com/badges/cbm-yii2-mailqueue/health.svg)](https://phpackages.com/packages/cbm-yii2-mailqueue)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)

PHPackages © 2026

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