Skip to content

whagency/yii2-html5-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-html5-notifications

Yii2 extension for converting yii2 flash message to html5 web notifications

Latest Stable Version License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "whagency/yii2-html5-notifications" "*"

or add to your composer.json file

"require": {
    "whagency/yii2-html5-notifications": "*"
},

Usage Example

  1. Add widget to your page before </body> tag
    ...

    <?= \webheads\notifications\Alert::widget(['options' => [
 	    'logo' => 'https://github.com/whagency/yii2-html5-notifications/blob/master/demo/icon.png',
 	    'hideAfter' => 5000,
    ]]) ?>

  </body>
</html>
  1. Set yii2 flash message
Yii::$app->session->setFlash('success', 'My notification message');
  1. Allow html5 messages in your browser

Demo 1

  1. Result

Demo 2

About

HTML5 web notifications for Yii2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages