定制 eluhr/yii2-notification-module 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eluhr/yii2-notification-module

最新稳定版本:1.3.10

Composer 安装命令:

composer require eluhr/yii2-notification-module

包简介

A notification module for Yii2

README 文档

README

composer require eluhr/yii2-notification-module

Configuration

use eluhr\notification\components\Notification as NotificationComponent;
use eluhr\notification\Module as NotificationModule;
...
'modules' => [
    'notification' => [
        'class' => NotificationModule::class
    ],
    'translatemanager' => [
        'root' => [
            '@vendor/eluhr/yii2-notification-module/src'
        ]
    ]
],
'components' => [
    'notification' => [
        'class' => NotificationComponent::class,
        'mailer' => 'mailer', // OPTIONAL: Default -> mailer
        'fromEmail' => 'notifications@domain.com' // REQUIRED
    ]
],
'controllerMap' => [
    'migrate' => [
        'migrationPath' => [
            '@vendor/eluhr/yii2-notification-module/src/migrations',
        ]
    ]
]
...

Example

Inbox from the point of view of a user with all authorizations Example inbox

Write a message to individual users or entire user groups Search messages by subject, author or text
Compse message Filtered inbox
Group users to create your own personal user groups Mark, read or delete messages
User group User group

Worth knowing

Requires PHP version >= 7.*

Example usuage

ExampleModel extends ActiveRecord implements ModelChangeNotification {
        
        /**
         * @return array
         */
        public function behaviors()
        {
            $behaviors = parent::behaviors();
            $behaviors['notification'] = [
                'class' => ModelChangeNotification::class,
                'receiverIds' => [MessageUserGroup::MESSAGE_USER_GROUP_ID_PREFIX . '1']
            ];
            return $behaviors;
        }
    
    
        /**
         * @return string
         */
        public function subject()
        {
            return $this->isNewRecord ? 'New entry' : ('Updated entry #' . $this->id);
        }
    
        /**
         * @return string
         */
        public function text()
        {
            $text = Html::tag('pre', htmlentities(json_encode($this->attributes, JSON_PRETTY_PRINT)));
            $text .= Html::tag('p', Html::a('Direct link',['/widgets/crud/widget-template/view','id' => $this->id], true));
            return $text;
        }
        
}

More infos coming soon

Ideas

The following stuff will probably come in a future release

  • Draft messages for later use
  • Ability to remove messages
  • Mark messages from users with a label or something
  • Notification Widget (AdminLTE)
  • Delete (inbox) message in overview (three dots option edit)
  • Translation config

统计信息

  • 总下载量: 14.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-07-12