1. Go to this page and download the library: Download lesha724/yii2-notification library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lesha724 / yii2-notification example snippets
Yii::$app->session->setFlash('bootstrap-success', 'This is the message');
Yii::$app->session->setFlash('sweeat-alert-success', 'This is the message');
<?= \lesha724\Notification\widgets\SweetAlert::widget([
'alertTypes' => [
'sweet-alert-error' => [
//you can use all options from http://t4t5.github.io/sweetalert/
'type' => 'error',
'title' => 'Error!',
/* function use example:
* function(isConfirm){
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
}
*/
'function' => null
],
'sweet-alert-success' => [
'type' => 'success',
'title' => 'Success!',
'function' => null
],
'sweet-alert-info' => [
'type' => 'info',
'title' => 'Info!',
'function' => null
],
'sweet-alert-warning' => [
'type' => 'warning',
'title' => 'Warning!',
'function' => null
],
],
]);
$function = <<<JS
function(isConfirm){
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
}
JS;
echo \lesha724\Notification\widgets\SimpleSweetAlert::widget([
'options'=>[
//you can use all options from http://t4t5.github.io/sweetalert/
'title'=> "Are you sure?",
'text'=> "You will not be able to recover this imaginary file!",
'type'=> "warning",
'showCancelButton'=> true,
'confirmButtonColor'=> "#DD6B55",
'confirmButtonText'=> "Yes, delete it!",
'cancelButtonText'=> "No, cancel plx!",
'closeOnConfirm'=> false,
'closeOnCancel'=> false,
'function'=>$function
]
])
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.