PHPackages                             mirocow/yii2-notification - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mirocow/yii2-notification

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

mirocow/yii2-notification
=========================

Yii2 notification

872[1 PRs](https://github.com/Mirocow/yii2-notification/pulls)PHP

Since Oct 23Pushed 6y ago4 watchersCompare

[ Source](https://github.com/Mirocow/yii2-notification)[ Packagist](https://packagist.org/packages/mirocow/yii2-notification)[ RSS](/packages/mirocow-yii2-notification/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii 2.0 Notification
====================

[](#yii-20-notification)

[![Latest Stable Version](https://camo.githubusercontent.com/6da61165e88779f5ab3fdd2cc598ef84b0460b061500efe9b533ec7ab03bae60/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d6e6f74696669636174696f6e2f762f737461626c65)](https://packagist.org/packages/mirocow/yii2-notification)[![Latest Unstable Version](https://camo.githubusercontent.com/3e1081fd7b7a90610a9406720653f7eb5a0797216b401830ea07561c63ec6edc/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d6e6f74696669636174696f6e2f762f756e737461626c65)](https://packagist.org/packages/mirocow/yii2-notification)[![Total Downloads](https://camo.githubusercontent.com/e87de5314eb14477eba5a957be6acb0c30afb661c5d393b350f7c4355ed52216/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d6e6f74696669636174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/mirocow/yii2-notification) [![License](https://camo.githubusercontent.com/609af6e547ec19773e39554a865aba3ceb4bc43645d009eed06d453a22b1f024/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d6e6f74696669636174696f6e2f6c6963656e7365)](https://packagist.org/packages/mirocow/yii2-notification)

Install
-------

[](#install)

```
$ composer require --prefer-dist "mirocow/yii2-notification"
$ php ./yii migrate/up -p=@mirocow/notification/migrations
```

Configurate
-----------

[](#configurate)

```
    'modules' => [
        // Notification by providers
        'notification' => [
          'class' => 'mirocow\notification\Module',
          'providers' => [

              // SMS prostor-sms.ru
              'sms' => [
                'class' => 'mirocow\notification\providers\sms',
                'config' => [
                  'gate' => '',
                  'port' => 80,
                  'login' => '',
                  'password' => '',
                  'signature' => '',
                ]
              ],

              // E-mail
              'email' => [
                'class' => 'mirocow\notification\providers\email',
                'emailViewPath' => '@common/mail',
                'events' => [
                  'frontend\controllers\SiteController' => [
                    'Request',
                    'Signup',
                  ],
                  'backend\controllers\deal\SiteController' => [
                    'Login',
                    'Confirm',
                  ]
                ]
              ]
          ],
        ]
    ],
```

Using
-----

[](#using)

### By method send

[](#by-method-send)

```
use mirocow\notification\components\Notification;

    /* @var \mirocow\notification\Module $sender */
    $sender = Yii::$app->getModule('notification');

    $notification = new Notification([
      'from' => [\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'],
      'to' => $deal['userSeller']['email'], // строка или массив
      'toId' => $deal['userSeller']['id'], // строка или массив
      'phone' => $deal['userSeller']['phone_number'], // строка или массив
      'subject' => "\"{$deal['userBuyer']['nameForOut']}\" предлагает вам сделку для \"{$deal['ads']['product']->getName()}\"",
      'token' => 'TOKEN',
      'content' => "",
      'params' => [
        'productName' => $deal['ads']['product']->getName(),
        'avatar' => $deal['userBuyer']->avatarFile,
        'fromUserName' => $deal['userBuyer']['nameForOut'],
      ],
      'view' => ['html' => 'Request-html', 'text' => 'Request-text'],
      'path' => '@common/mail/deal',
      'notify' => ['growl', 'На Ваш email отправлено письмо для подтверждения'],
      'callback' => function(Provider $provider, $status){
        // Тут можно обработать ответ от провайдеров нотификаций
      }
    ]);

    $sender->sendEvent($notification);
```

### By Event

[](#by-event)

```
use yii\base\Event;
use mirocow\notification\components\Notification;

$event = new Notification(['params' => [
  'from' => [\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'],
  'to' => $user->email,
  'subject' => 'Регистрация на сайте ' . \Yii::$app->name,
  'emailView' => ['html' => 'signUp-html', 'text' => 'signUp-text'],
  'user' => $user,
  'phone' => $user->phone_number,
  'notify' => ['growl', 'На Ваш email отправлено письмо для подтверждения'],
]]);
Notification::trigger(self::className(),'Signup', $event);
```

or full

```
$notification = new Notification([
  'from' => [\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'],
  'to' => $deal['userSeller']['email'], // строка или массив
  'toId' => $deal['userSeller']['id'], // строка или массив
  'phone' => $deal['userSeller']['phone_number'], // строка или массив
  'subject' => "\"{$deal['userBuyer']['nameForOut']}\" предлагает вам сделку для \"{$deal['ads']['product']->getName()}\"",
  'token' => 'TOKEN',
  'content' => "",
  'params' => [
    'productName' => $deal['ads']['product']->getName(),
    'avatar' => $deal['userBuyer']->avatarFile,
    'fromUserName' => $deal['userBuyer']['nameForOut'],
  ],
  'view' => ['html' => 'Request-html', 'text' => 'Request-text'],
  'path' => '@common/mail/deal',
  'notify' => ['growl', 'На Ваш email отправлено письмо для подтверждения'],
  'callback' => function(Provider $provider, $status){
    // Тут можно обработать ответ от провайдеров нотификаций
  }
]);
Notification::trigger(self::className(),'Request', $notification);
```

### With mirocow/yii2-queue

[](#with-mirocowyii2-queue)

```
    \Yii::$app->queue->getChannel()->push(new MessageModel([
        'worker' => 'notification',
        'method' => 'action',
        'arguments' => [
            'triggerClass' => self::class,
            'methodName' => 'Subscribe',
            'arguments' => [
                'param' => 'value'
            ],
        ],
    ]), 30);
```

Tests
-----

[](#tests)

```
$ ./vendor/bin/codecept -c ./vendor/mirocow/yii2-notification run unit
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b153b4b289b4cae263a6422fc4b660bb6b78392637914110f62a905d389656df?d=identicon)[Mirocow](/maintainers/Mirocow)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mirocow-yii2-notification/health.svg)

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

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2752.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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