branchonline / yii2-sweetalert
SweetAlert widget for Yii2
Package info
github.com/BranchOnline/yii2-sweetalert
Type:yii2-extension
pkg:composer/branchonline/yii2-sweetalert
1.0.1
2015-11-20 07:47 UTC
Requires
- bower-asset/sweetalert: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2026-03-05 03:33:06 UTC
README
- SweetAlert widget based on SweetAlert extension http://tristanedwards.me/sweetalert
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist branchonline/yii2-sweetalert "*"
or add
"branchonline/yii2-sweetalert": "*"
to the require section of your composer.json.
Usage
Once the extension is installed, simply add widget to your page as follows:
- Default usage, render all flash messages stored in session flash via Yii::$app->session->setFlash().
echo SweetAlert::widget();
- Custom usage example:
echo SweetAlert::widget([ 'useSessionFlash' => false, 'options' => [ 'title' => 'Success message', 'type' => 'Success', 'text' => "You will not be able to recover this imaginary file!", 'confirmButtonText' => "Yes, delete it!", 'cancelButtonText' => "No, cancel plx!" ] ]);
More info
More info about the SweetAlert can be found on options page