定制 szmnmichalowski/szm-notification 二次开发

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

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

szmnmichalowski/szm-notification

Composer 安装命令:

composer require szmnmichalowski/szm-notification

包简介

Controller plugin to store notifications in session. Used for notification view helper

README 文档

README

Software License Build Status Code Coverage

SzmNotification is a Zend Framework 2/3 controller plugin which stores notification in session container (same as FlashMessanger). It is designed to work with one of the following notifiction helpers:

Installation

You can install this module via composer

1. Add this project into your composer.json

"require": {
    "szmnmichalowski/szm-notification": "dev-master"
}

2. Update your dependencies

$ php composer.phar update

3. Add module to your application.config.php. It requires Zend\Session

return array(
    'modules' => array(
        'Zend\Session',
        'SzmNotification' // <- Add this line
    )
);

Usage

This plugin has defined 4 types of notifications by default:

  • info
  • success
  • warning
  • error

But it is possible to add notification under custom type

How to use it

Examples of use:

$this->notification()->add('info', 'Lorem ipsum');
$this->notification()->has('info');
$this->notification()->get('info');

$this->notification()->addInfo('Lorem ipsum');
$this->notification()->hasInfo();
$this->notification()->getInfo();

Available methods:

Global methods:

  • add($type, $text) - Add notification
  • has($type) - Check if namespace contains any notification added in previous request
  • hasCurrent($type) - Check if namespace contains any notification added during this request
  • get($type) - Return notifications from previous request
  • getCurrent($type) - Return notifications from current request
  • getAll() - Return all notifications from previous request
  • getAllCurrent() - Return all notifications from current request

Following methods are available for each type (including custom type). Just replace * with notification type:

  • add*($text) - Add notification
  • has*() - Check if namespace contains any notification added in previous request
  • hasCurrent*() - Check if namespace contains any notification added during this request
  • get*() - Return notifications from previous request
  • getCurrent*() - Return notifications from current request

Examples:

$this-notification()->addCustomType('This is custom type notification');
$this-notification()->addFoo('This is custom type notification');
$this-notification()->addBar('This is custom type notification');

$this-notification()->getCustomType();
$this-notification()->getFoo();
$this-notification()->getCurrentBar();

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固