2017 © Pedro PelĂĄez
 

library szm-notification

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

image

szmnmichalowski/szm-notification

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

  • Saturday, March 25, 2017
  • by szmnmichalowski
  • Repository
  • 1 Watchers
  • 0 Stars
  • 24 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SzmNotification

Software License Build Status Code Coverage, (*1)

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: - SzmNoty - jQuery plugin http://ned.im/noty/, (*2)

Installation

You can install this module via composer, (*3)

1. Add this project into your composer.json, (*4)

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

2. Update your dependencies, (*5)

$ php composer.phar update

3. Add module to your application.config.php. It requires Zend\Session, (*6)

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, (*7)

But it is possible to add notification under custom type, (*8)

How to use it

Examples of use:, (*9)

$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, (*10)

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, (*11)

Examples:, (*12)

$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();

The Versions

25/03 2017

dev-master

9999999-dev https://github.com/szmnmichalowski/SzmNotification

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Szymon MichaƂowski

plugin extension zend notification

25/03 2017

1.0.0

1.0.0.0 https://github.com/szmnmichalowski/SzmNotification

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Szymon MichaƂowski

plugin extension zend notification