Simple but useful JS notification script with PHP Api.
This simple extension helps to show nice notifications in browser. It uses FontAwesome icons and can be customised by overwriting base CSS styles.
$ composer require floor12/yii2-notification
or add this to the require section of your composer.json.
floor12\notification\NotificationAsset in your app.
In case if using PHP api,
NotificationAsset will be included in your app by
Show notification by run JS function
info(text,type) with text and one of this types:
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');