PHPackages                             d3yii2/d3notification - 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. d3yii2/d3notification

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

d3yii2/d3notification
=====================

Notification registry

0116PHP

Since Oct 29Pushed 8mo ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)

\#Notification"

Features
--------

[](#features)

For active records register events (time,status, notification class, user). Status can be changed. Collect status history.

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

[](#installation)

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

Either run

```
$ composer require d3yii2/d3notification "*"

```

or add

```
"d3yii2/d3notification": "*"

```

to the `require` section of your `composer.json` file.

To console config add migration
-------------------------------

[](#to-console-config-add-migration)

```
return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@vendor/d3yii2/d3notification/migrations',
            ]
        ],
    ]
];
```

translation
-----------

[](#translation)

```
    'd3notification' => [
        'class' => 'yii\i18n\PhpMessageSource',
        'basePath' => '@vendor/d3yii2/d3notification/messages',
        'sourceLanguage' => 'en-US'
    ],
```

DB
--

[](#db)

[![DB strukture](https://github.com/d3yii2/d3notification/raw/master/doc/DbSchema.png)](https://github.com/d3yii2/d3notification/blob/master/doc/DbSchema.png)

Methods
-------

[](#methods)

Usage
-----

[](#usage)

Examples
--------

[](#examples)

### notification model

[](#notification-model)

Extend regular model and implement Notification interface

```
class KpsSmgsNotification extends KpsSmgs implements Notification
{

    public const NOTIFICATION_NEW_ID = 1;
    public const NOTIFICATION_RESOLVED_ID = 2;
    public const NOTIFICATION_IGNORED_ID = 3;

    public const NOTIFICATION_TYPE_NO_DELIVERY = 1;
    public const NOTIFICATION_TYPE_MISMATCH_LOAD_STATION = 2;
    public const NOTIFICATION_TYPE_MISMATCH_END_STATION = 3;
    public const NOTIFICATION_TYPE_KPS_EXTRA_CAR = 4;
    public const NOTIFICATION_TYPE_DELIVERY_EXTRA_CAR = 5;
    public const NOTIFICATION_TYPE_DIFF_WEIGHT = 6;

    /** @var CmdDelivery */
    public $delivery;

    /** @var CmdDCar */
    public $deliveryCar;

    /** @var KpsSmgs */
    public $smgs;

    /** @var KpsSmgsWagon */
    public $smgsWagon;

    /** @var CmdStatus */
    public $deliveryStatus;
    /**
     * @var mixed|null
     */
    public $statusId;
    /**
     * @var mixed|null
     */
    public $typeId;

    public function getNotificationData(): array
    {
        $data = [];
        if($this->deliveryCar){
            $data['deliveryCarNumber'] = $this->deliveryCar->number;
        }
        if($this->deliveryStatus){
            $data['deliveryStatusType'] = $this->deliveryStatus->type;
            $data['deliveryStatusStation'] = TtStation::findOne($this->deliveryStatus->station_id)->name_ru;
        }

        if($this->delivery){
            $data['deliveryWeight'] = $this->delivery->weight;
            $data['deliverySmgsNumber'] = $this->delivery->delivery_note;
        }

        if($this->smgs){
            $data['kpsSmgsNumber'] = $this->smgs->number;
        }

        if($this->smgsWagon){
            $data['kpsCarNumber'] = $this->smgsWagon->number;
            $data['kpsCarWeight'] = $this->smgsWagon->weight;
        }
        return $data;
    }

    public function getNotificationKey(): int
    {
        if($this->delivery){
            return $this->delivery->id;
        }
        return 0;
    }
    public function getNotificationRecordId(): int
    {
        return $this->id;
    }

    public function getNotificationStatusList(): array
    {
        return [
            self::NOTIFICATION_NEW_ID => 'New',
            self::NOTIFICATION_RESOLVED_ID => 'Resolved',
            self::NOTIFICATION_IGNORED_ID => 'Ignored'
        ];
    }

    public function getNotificationTypeList(): array
    {
        return [
            self::NOTIFICATION_TYPE_NO_DELIVERY => 'Not Found Delivery record',
            self::NOTIFICATION_TYPE_MISMATCH_LOAD_STATION => 'Mismatch load station',
            self::NOTIFICATION_TYPE_MISMATCH_END_STATION => 'Mismatch end station',
            self::NOTIFICATION_TYPE_KPS_EXTRA_CAR => 'KPS Extra car',
            self::NOTIFICATION_TYPE_DELIVERY_EXTRA_CAR => 'Delivery Extra Car',
            self::NOTIFICATION_TYPE_DIFF_WEIGHT => 'Different weight',
        ];
    }

    public function getStatusId(): int
    {
        return $this->statusId;
    }

    public function getTypeId(): int
    {
        return $this->typeId;
    }
}
```

\###Notification registration

```
$logic = new NotificationLogic($companyId,$userId);
$notification = new KpsSmgsNotification();
$notification->attributes = $smgs->attributes;
$notification->typeId = KpsSmgsNotification::NOTIFICATION_TYPE_MISMATCH_END_STATION;
$notification->statusId = KpsSmgsNotification::NOTIFICATION_NEW_ID;
$notification->smgs = $smgs;
$notification->delivery = $delivery;
$notification->deliveryStatus = $statusEndStation;
$logic->register($notification);
```

\###Notification registration by form To controlier add action

```
    public function actions()
    {
        return [
            'notification-create' => [
                'class' => CreateNotification::class,
                'notificationModelClass' => MTaskNotification::class,
                'typeId' => MTaskNotification::NOTIFICATION_TYPE_OTHER,
                'backUrl' => ['view','id' => '@id'],
                'notesList' => [
                    'aaa1',
                    'aaa2',
                 ]
            ]
        ];
    }
```

### widget for model actions

[](#widget-for-model-actions)

show all model record notifications

```
        echo ModelNotifications::widget([
            'modelClass' => MTaskNotification::class,
            'modelRecordId' => $model->id
        ]);
```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance43

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.7% 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/542187ba859514d10d0952dca77df8ea889a9651b249d0b5b513da791fd2919b?d=identicon)[uldisn](/maintainers/uldisn)

---

Top Contributors

[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (49 commits)")[![anothersoftware-lv](https://avatars.githubusercontent.com/u/9327511?v=4)](https://github.com/anothersoftware-lv "anothersoftware-lv (5 commits)")

### Embed Badge

![Health badge](/badges/d3yii2-d3notification/health.svg)

```
[![Health](https://phpackages.com/badges/d3yii2-d3notification/health.svg)](https://phpackages.com/packages/d3yii2-d3notification)
```

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[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)
