Skip to content

Модуль уведомлений для приложений на Yii2

License

Notifications You must be signed in to change notification settings

kaswell/yii-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Card

Notifications for Yii2

License Total size Last Version

Notifier is used as an application component and configured in the application configuration like the following:

[
   'components' => [
       'notifier' => [
           'class' => \kaswell\notification\Notifier::class,
           'channels' => [
               'telegram' => [
                    'class' => \kaswell\notification\channels\TelegramChannel::class,
                    'botToken' => '...'
                ],
               'mail' => [
                   'class' => \kaswell\notification\channels\MailChannel::class,
                   'from' => 'no-reply@example.com'
               ],
               'database' => [
                    'class' => \kaswell\notification\channels\ActiveRecordChannel::class
               ]
           ],
       ],
   ],
]

Add NotificationBehavior to any model or active record

public function behaviors()
{
    return [
        ...
        [
            'class' => ActiveRecordBehavior::class,
            'excludedAttributes' => ['updated_at'],
        ],
        ...
    ];
}

Migrations

yii migrate --migrationPath=@vendor/kaswell/yii-notifications/src/migrations

or

'controllerMap' => [
    ...
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [
            'kaswell\notification\migrations',
        ],
    ],
    ...
],

About

Модуль уведомлений для приложений на Yii2

Topics

Resources

License

Stars

Watchers

Forks

Languages