PHP code example of kamran377 / yii2-sweetalert2

1. Go to this page and download the library: Download kamran377/yii2-sweetalert2 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/ */

    

kamran377 / yii2-sweetalert2 example snippets


Yii::$app->session->setFlash('success', 'This is the message');

echo kamran377\sweetalert2\SweetAlert::widget();

// A replacement for the "prompt" function

echo \kamran377\yii2-sweetalert2\SweetAlert::widget([
        'type' => \kamran377\yii2-sweetalert2\SweetAlert::TYPE_WARNING,
        'options' => [
            'title' => 'Oops...',
            'text' => 'Something went wrong!',
            'footer' => '<a href>Why do I have this issue?</a>'
        ]
]);

'assetManager' => [
    'bundles' => [
        'kamran377\yii2-sweetalert2\SweetAlertAsset' => [
            'overrideConfirm' => false
        ]
    ]
]

php composer.phar