PHPackages                             mirkhamidov/yii2-notifications - 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. mirkhamidov/yii2-notifications

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

mirkhamidov/yii2-notifications
==============================

Notifications system

0.3.1(7y ago)047BSD-3-ClausePHP

Since Jun 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/m1roff/yii2-notifications)[ Packagist](https://packagist.org/packages/mirkhamidov/yii2-notifications)[ RSS](/packages/mirkhamidov-yii2-notifications/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

TODO
====

[](#todo)

- configure `components` from module
- configure `queueNotification` from module
- add requirements in composer.json
- slack notifications
- email notifications

Notification providers
======================

[](#notification-providers)

Telegram
--------

[](#telegram)

description see below, in examples

Default Yii2 Mailer
-------------------

[](#default-yii2-mailer)

configure in main config file `main.php`

```
return [
    'modules' => [
        ...
        'notifications' => [
            'class' => mirkhamidov\notifications\Module::class,
            'queueIn' => 'queueNotifications',
            'providers' => [
                ...
                'default-mailer' => [
                    'class' => MailerProvider::class,
                    'from' => [{SENDER EMAIL} => {SENDER NAME}],
                ],
            ],
        ],
    ],
];

```

send using view file and view params

```
Yii::$app->notifications->sendTemplateMail([
    'to' => {RECEPIENT EMAIL},
    'subject' => {SUBJECT},
    'view' => ['html' => {HTML VIEW}, 'text' => {TEXT VIEW}],
    'params' => [
        {KEY-VALUE params for views}
    ],
]);

```

or already rendered/prepared text and other params

```
Yii::$app->notifications->sendTemplateMail([
    'to' => {RECEPIENT EMAIL},
    'subject' => 'Test messages fo ' . rand(1, 99999),
    'htmlBody' => $msg,
    ['textBody' => $msg,]
    ['cc' => {CC},]
    ['bcc' => {BCC},]
    ['replyTo' => {REPLY TO EMAIL},]
    ['attachFilePath' => {PATH TO FILE TO ATTACH},]
]);

```

Configuration
=============

[](#configuration)

in main app config file

```
return [
    'bootstrap' => [
        'queueNotifications',
    ],
    'components' => [
        'queueNotifications' => [
            'class' => \yii\queue\db\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,
            'db' => 'db', // DB connection component or its config
            'tableName' => '{{%queue}}', // Table name
            'channel' => 'notification', // Queue channel key
            'mutex' => \yii\mutex\PgsqlMutex::class, // Mutex that used to sync queries
            'mutexTimeout' => 0,
            'ttr' => 5 * 60, // Max time for anything job handling
            'attempts' => 5, // Max number of attempts
        ],
        'notifications' => [
            'class' => \mirkhamidov\notifications\Notifications::class,
        ],
    ],
    'modules' => [
        'notifications' => [
            'class' => mirkhamidov\notifications\Module::class,
            'queueIn' => 'queueNotifications',
            'providers' => [
                'telegram' => [
                    'class' => \mirkhamidov\notifications\providers\Telegram::class,
                ],
            ],
        ],
    ],
];
```

Logs to different file
----------------------

[](#logs-to-different-file)

In app config file

```
'components' => [
    'log' => [
        'targets' => [
            ...
            [
                'class' => 'yii\log\FileTarget',
                'categories' => [
                    'mirkhamidov\notifications\providers\*',
                ],
                'logFile' => '@app/runtime/logs/notification-providers.log',
                'logVars' => [],
                'prefix' => function ($message) {
                    return '';
                }
            ],
        ],
    ],
],

```

Examples
========

[](#examples)

Telegram Send message
---------------------

[](#telegram-send-message)

```
use mirkhamidov\notifications\providers\TelegramProvider;

$msg = 'any message';
\Yii::$app->notifications->send($msg, TelegramProvider::ID, [
    'providerParams' => [
        'chat_id' => {CHAT_ID},
    ],
]);

```

More `providerParams` look at [Telegram SendMessage API](https://core.telegram.org/bots/api#sendmessage)

Telegram Message with file
--------------------------

[](#telegram-message-with-file)

```
use mirkhamidov\notifications\providers\TelegramProvider;

$msg = 'any message';

\Yii::$app->notifications->send($msg, TelegramProvider::ID, [
    'providerParams' => [
        'chat_id' => Yii::$app->params['telegram']['miroff'],
        'file' => $model->getPdfFilePath(),
        'fileParams' => [
            // custom params
            ['fileType' => TelegramProvider::FILE_TYPE_DOCUMENT,]
            ['messageMergeType' => TelegramProvider::FILE_MESSAGE_MERGE_TYPE_AS_REPLY,]

            // any other Telegram API params, see below
            ['disable_notification' => true,]
        ],
    ],
]);

```

- `file` full path to file
- `fileParams` params to manage with file
    - `messageMergeType`
        - TelegramProvider::FILE\_MESSAGE\_MERGE\_TYPE\_AS\_NO\_MERGE **default** send message and file as separate messages
        - TelegramProvider::FILE\_MESSAGE\_MERGE\_TYPE\_AS\_REPLY send file as reply for sent message
    - `fileType`
        - TelegramProvider::FILE\_TYPE\_DOCUMENT **default** [Telegram API for more params](https://core.telegram.org/bots/api#senddocument)
        - TelegramProvider::FILE\_TYPE\_PHOTO [Telegram API for more params](https://core.telegram.org/bots/api#sendphoto)
        - TelegramProvider::FILE\_TYPE\_AUDIO [Telegram API for more params](https://core.telegram.org/bots/api#sendaudio)
        - TelegramProvider::FILE\_TYPE\_VIDEO [Telegram API for more params](https://core.telegram.org/bots/api#sendvideo)

To send only file (without message) just set `$mgs` to `null`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~20 days

Total

4

Last Release

2836d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

notificationsyii2moduletelegram

### Embed Badge

![Health badge](/badges/mirkhamidov-yii2-notifications/health.svg)

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

###  Alternatives

[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[yiimaker/yii2-email-templates

Extension for creating of email templates and manage using your site dashboard

9219.4k1](/packages/yiimaker-yii2-email-templates)[tuyakhov/yii2-notifications

The extension provides support for sending notifications across a variety of delivery channels, including mail, SMS, Slack etc. Notifications may also be stored in a database so they may be displayed in your web interface.

6735.5k2](/packages/tuyakhov-yii2-notifications)[onmotion/yii2-telegram

Support chat for site based on Telegram bot

526.3k](/packages/onmotion-yii2-telegram)

PHPackages © 2026

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