eluhr / yii2-notification-module
A notification module for Yii2
Installs: 12 684
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- 2amigos/yii2-ckeditor-widget: ^2.0.2
- 2amigos/yii2-usuario: ^1.5.0
- dmstr/yii2-adminlte-asset: ^2.5.0
- kartik-v/yii2-widget-select2: ^2.0.1
- yiisoft/yii2-dev: ~2.0.11
Requires (Dev)
- codeception/codeception: ^3.1.3
- dmstr/yii2-db: ^0.9.4
- dev-master
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 1.0.0-rc7
- 1.0.0-rc6
- 1.0.0-rc5
- 1.0.0-rc4
- 1.0.0-rc3
- 1.0.0-rc2
- 1.0.0-rc1
- dev-dev-security/message-value
- dev-dev/2.x
- dev-feature/bulk-delete-read
- dev-feature/add-names-to-notifs
This package is auto-updated.
Last update: 2024-12-15 14:29:23 UTC
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
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