PHPackages                             skinka/yii2-alert-gritter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. skinka/yii2-alert-gritter

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

skinka/yii2-alert-gritter
=========================

Gritter. Popup messages

1.3(10y ago)12.7k↓50%3MITPHPPHP &gt;=5.4.0

Since Sep 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Skinka/yii2-alert-gritter)[ Packagist](https://packagist.org/packages/skinka/yii2-alert-gritter)[ Docs](http://github.com/skinka/yii2-alert-gritter)[ RSS](/packages/skinka-yii2-alert-gritter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

\#Yii2 Alert Gritter v.1.3 jQuery plugin a small notifications

\#Install The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist skinka/yii2-alert-gritter

```

or add

```
"skinka/yii2-alert-gritter": "*"

```

to the require section of your `composer.json` file.

\#Used ##Widget Alert widget renders a message from session flash. All flash messages are displayed in the sequence they were assigned using setFlash. You can set message as following:

Create message:

```
\Yii::$app->getSession()->setFlash('error', 'This is the message');
\Yii::$app->getSession()->setFlash('success', 'This is the message');
\Yii::$app->getSession()->setFlash('info', 'This is the message');
```

Show message:

```

```

Widget options:

Enabled icons for alert message

```
'enableIcon' => true;
```

The alert types configuration for the flash messages. `type` *type flash*

- `class` *class block notify*
- `icon` *class icon in message*
- `title` *title type message*

```
'options' => [
    'error' => [
        'class' => 'gritter-danger',
        'icon' => 'fa fa-times',
        'title' => 'Error',
    ],
];
```

Options for Jquery Gritter plugin

```
'gritterOptions' => [
    // (bool | optional) if you want it to fade out on its own or just sit there
    'sticky' =>  true,

    // (int | optional) the time you want it to be alive for before fading out
    'time' => '',

     // possibilities: POS_BL, POS_BR, POS_TL, POS_TR
    'position' => skinka\widgets\gritter\AlertGritterWidget::POS_BL,

    // how fast notifications fade in (string or int)
    'fade_in_speed' => 100,

    // how fast the notices fade out
    'fade_out_speed' => 100,

    // (function | optional) function called before it opens
    'before_open' => new JsExpression('function(){}'),

    // (function | optional) function called after it opens
    'after_open' => new JsExpression('function(e){}'),

    // (function | optional) function called before it closes
    'before_close' => new JsExpression('function(e, manual_close){}'),

    // (function | optional) function called after it closes
    'after_close' => new JsExpression('function(e, manual_close){}'),
];
```

\##JavaScript notify

Show message:

```
