2017 © Pedro Peláez
 

yii2-extension yii2-toastr

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

image

maxodrom/yii2-toastr

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

  • Saturday, June 30, 2018
  • by mercium
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Yii2 Toastr Notification

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist odaialali/yii2-toastr "*"

or add, (*4)

"odaialali/yii2-toastr": "*"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, you can test that the extension works by simply use it in your code by :, (*6)

<?= \odaialali\yii2toastr\Toastr::widget([
    'toastType' => 'error',
    'message' => 'This is an error.',
    'customStyle' => false
]);?>

There are 2 main useful widgets, (*7)

ToastrFlash

displays Yii flash messages in toastr notification style, (*8)

<?php
$session = \Yii::$app->getSession();
$session->setFlash('error', "msg1");
$session->setFlash('danger', "msg2");
$session->setFlash('warning', "msg3");
$session->setFlash('info', "msg4");
$session->setFlash('success', "msg5");
?>

```php = \odaialali\yii2toastr\ToastrFlash::widget([ 'options' => [ 'positionClass' => 'toast-bottom-left' ] ]);?>, (*9)


ToastrAjaxFeed -------------- fetch notification from ajax url ```php <?= \odaialali\yii2toastr\ToastrAjaxFeed::widget([ 'feedUrl' => yii\helpers\Url::toRoute('/user/profile/notification-feed'), 'interval' => 5000, 'options' => [ 'positionClass' => 'toast-bottom-left' ] ]);?>

the ajax controller should return an array like this, (*10)

public function actionNotificationFeed(){
    $ret = [
        [
            'type' => 'error',
            'message' => 'error message',
            'title' => 'Hey!'
        ],
        [
            'type' => 'info',
            'message' => 'another message',
            'title' => 'Hello'
        ]
    ];
    return \yii\helpers\Json::encode($ret);
}

The Versions

30/06 2018

dev-master

9999999-dev

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

  Sources   Download

Apache-2.0

The Requires

 

by Odai Alali

extension yii2 notification toastr

30/06 2018

1.1.1

1.1.1.0

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

  Sources   Download

Apache-2.0

The Requires

 

by Odai Alali

extension yii2 notification toastr

08/06 2018

1.1

1.1.0.0

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

  Sources   Download

Apache-2.0

The Requires

 

by Odai Alali

extension yii2 notification toastr

28/01 2015

1.0b

1.0.0.0-beta

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

  Sources   Download

Apache-2.0

The Requires

 

by Odai Alali

extension yii2 notification toastr