Javascript notification with php api.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Notification.php
NotificationAsset.php
README.md
composer.json
floor12-notification.css
floor12-notification.css.map
floor12-notification.js
floor12-notification.scss

README.md

yii2-notification

Latest Stable Version Latest Unstable Version Total Downloads License

This simple extension helps to show nice notifications in browser. It uses FontAwesome icons and can be customised by overwriting base CSS styles.

Image

Installation

Just run:

$ composer require floor12/yii2-notification

or add this to the require section of your composer.json.

"floor12/yii2-notification": "dev-master"

To use javascript way, add floor12\notification\NotificationAsset in your app.

In case if using PHP api, NotificationAsset will be included in your app by Notification class.

Usage

Show notification by run JS function info(text,type) with text and one of this types:

  • 0 - information;
  • 1 - success;
  • 2 - error;

For example:

if (success == true)
    info('Model  saved',1);    
else
    info('Something wrong here',2);

Its also possible to show notifications by calling PHP API:

use floor12\notification\Notification;

Notification::info('The form is loading...');
Notification::error('Pleas fill all required fields');
Notification::success('This model is saved');