xelax90/zf-user-notification
Composer 安装命令:
composer require xelax90/zf-user-notification
包简介
Event-Driven User notification system
README 文档
README
This module provides an event-driven and simple user notification system.
Installation
Installation of XelaxUserNotification uses composer. For composer documentation, please refer to getcomposer.org.
composer require xelax90/zf-user-notification
Then add XelaxUserNotification to your config/application.config.php and run
the doctrine schema update to create the database table:
php vendor/bin/doctrine-module orm:schema-tool:update --force
Now copy the provided configuration files
vendor/xelax90/zf-user-notification/config/xelax-user-notification.global.php and
vendor/xelax90/zf-user-notification/config/xelax-user-notification.local.php.dist
into your config/autoload directory. Also make another copy of the
xelax-user-notification.local.php.dist file without the .dist extension.
Configuration
To send notifications via E-Mail please enter your mailserver configuration in
the config/autoload/xelax-user-module.local.php file.
You can use the global configuration in config/autoload/xelax-user-module.global.php
to modify E-Mail templates and other global settings. Every setting is documented
inside the configuration file.
Sending notifications
To send a notification, get an instance of the
XelaxUserNotification\Service\Notification Service from the Service Manager and
call one of the functions sendSystemNotification (For system-to-user notifications),
sendUserNotification (For user-to-user notifications). These functions create
an instance of NotificationInterface and trigger the corresponding event such
that any notification handler can handle the created notification. To send custom
events and notifications, use the sendNotification Method.
Handling notifications
To handle a notification, simply create an event listener that listens to
events from the XelaxUserNotification\Service\Notification class. There are
two default events, namely Notification::EVENT_SYSTEM_NOTIFICATION and
Notification::EVENT_USER_NOTIFICATION for the two different notification types.
There are some default notification handlers that you should maybe look at before
implementing additional logic.
Render And Mail Handler
The RenderAndMailHandler uses a templte engine to render a notification and
then sends it to the receiver using a mail transport. By default it uses the
Zend\View\Renderer\PhpRenderer template engine and the
Zend\Mail\Transport\TransportInterface service as transport. The transport
service can be registered using the xelax90/zf-mail-config module.
You can configure the templates within your application or module config. There
is some documentation provided in the global configuration file. The configured
e-mail templates will be passed through the MvcTranslator to obtain localized
template names which are then passed to the template engine (see
language/en_US.php and language/de_DE.php).
xelax90/zf-user-notification 适用场景与选型建议
xelax90/zf-user-notification 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 12 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 xelax90/zf-user-notification 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xelax90/zf-user-notification 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPLv2
- 更新时间: 2016-12-24