Alert widget based on SweetAlert extension {@link

Installs: 154

Dependents: 0

Suggesters: 0

Stars: 2

Watchers: 2

Forks: 18


dev-master 2017-09-18 17:26 UTC



The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist marqu3s/yii2-sweet-alert "*"

or add

"marqu3s/yii2-sweet-alert": "*"

to the require section of your composer.json.


Once the extension is installed, simply add widget to your page as follows:

  1. Default usage, render all flash messages stored in session flash via Yii::$app->session->setFlash().
echo Alert::widget(); 
  1. Custom usage example:
echo Alert::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!"

Alert Options

You can find them on the options page