abushamleh / yii2-toast
Yii2 toast alert
Installs: 3 077
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0
This package is not auto-updated.
Last update: 2024-11-13 05:53:28 UTC
README
Run the Composer command to install the latest version:
composer require abushamleh/yii2-toast "dev-master"
Usage
ToastAlert
use abushamleh\toast\ToastAlert; echo ToastAlert::widget([ 'options' => [], 'heading' => 'heading', 'text' => 'text', 'type' => 'type', ]);
ToastBlock
ToastBlock widget renders a message from session flash. All flash messages are displayed in the sequence they were assigned using setFlash.
use abushamleh\toast\ToastBlock; //You can set message as following: Yii::$app->session->setFlash('error', 'This is the message'); Yii::$app->session->setFlash('success', 'This is the message'); Yii::$app->session->setFlash('info', 'This is the message'); Yii::$app->session->setFlash('info', ['heading' => 'Message title' 'text' => 'This is the message']); //Multiple messages could be set as follows: Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); Yii::$app->session->setFlash('error', [['heading' => 'Message title' 'text' => 'This is the message'], 'Error 2']); echo ToastBlock::widget([ 'options' => [] ]);