PHPackages                             rahulabs/yii2-toastr - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. rahulabs/yii2-toastr

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

rahulabs/yii2-toastr
====================

Simple javascript toast notifications

1.0.1(1y ago)119BSD-3-ClausePHPPHP &gt;=7.4

Since Aug 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/rahulabs/yii2-toastr)[ Packagist](https://packagist.org/packages/rahulabs/yii2-toastr)[ Docs](https://github.com/rahulabs/yii2-toastr)[ RSS](/packages/rahulabs-yii2-toastr/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Yii2 - Javascript Toast Notifications
=====================================

[](#yii2---javascript-toast-notifications)

Simple javascript toast notifications - Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.

[![Latest Stable Version](https://camo.githubusercontent.com/7f6833f55e47c3c92ed6dfb30f1583aa010ac860e693acb99e1fa6ecbefccb0d/68747470733a2f2f706f7365722e707567782e6f72672f726168756c6162732f796969322d746f617374722f762f737461626c65)](https://packagist.org/packages/rahulabs/yii2-toastr) [![Total Downloads](https://camo.githubusercontent.com/3bd6d8b568d9ab6f450a38848af5ffee86b0b26c1d77fbbc3406e1b29e78dd0f/68747470733a2f2f706f7365722e707567782e6f72672f726168756c6162732f796969322d746f617374722f646f776e6c6f616473)](https://packagist.org/packages/rahulabs/yii2-toastr) [![Latest Unstable Version](https://camo.githubusercontent.com/67489e46547ff7f7bdfda56c69220fe2c411ad043dff67a11081c9779429ffec/68747470733a2f2f706f7365722e707567782e6f72672f726168756c6162732f796969322d746f617374722f762f756e737461626c65)](https://packagist.org/packages/rahulabs/yii2-toastr) [![License](https://camo.githubusercontent.com/63efaaf3dd4be4dde93e1805c15d9138c24c3b8d05eb4890939ef4aa050d83e7/68747470733a2f2f706f7365722e707567782e6f72672f726168756c6162732f796969322d746f617374722f6c6963656e7365)](https://packagist.org/packages/rahulabs/yii2-toastr)

Installation
------------

[](#installation)

The extension is installed using Composer installation instructions [Composer](http://getcomposer.org/doc/00-intro.md#installation-nix)

The extension is installed using Composer installation instructions

```
composer require --prefer-dist rahulabs/yii2-toastr

```

or (master)

```
composer require --prefer-dist rahulabs/yii2-toastr "dev-master"

```

or make changes to the section `require` в `composer.json` and execute `composer update`

```
"rahulabs/yii2-toastr": "^2.0"

```

or (master)

```
"rahulabs/yii2-toastr": "dev-master"

```

```
use rahulabs\widgets\toastr\Notification;

Notification::widget([
    'type' => 'info',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'error',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'success',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'warning',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'info',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'error',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'success',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'warning',
    'message' => 'Simple javascript toast notifications'
]);
```

There is also the possibility of setting up a custom notification, according to the parameters provided by the developers. [Toastr by CodeSeven](https://github.com/CodeSeven/toastr)

[![alt text](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-3.png "Notifications Notification::widget()")](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-3.png)

```
Notification::widget([
    'type' => Notification::TYPE_ERROR,
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications',
    'options' => [
        "closeButton" => false,
        "debug" => false,
        "newestOnTop" => false,
        "progressBar" => false,
        "positionClass" => Notification::POSITION_TOP_RIGHT,
        "preventDuplicates" => false,
        "onclick" => null,
        "showDuration" => "300",
        "hideDuration" => "1000",
        "timeOut" => "5000",
        "extendedTimeOut" => "1000",
        "showEasing" => "swing",
        "hideEasing" => "linear",
        "showMethod" => "fadeIn",
        "hideMethod" => "fadeOut"
    ]
]);
```

### Notifications NotificationFlash::widget()

[](#notifications-notificationflashwidget)

The connection is made globally, for example in the project layouts.

```

```

There is also the possibility of setting up notifications according to the parameters provided by the developers. [Toastr by CodeSeven](https://github.com/CodeSeven/toastr)

```

```

[![alt text](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-4.png "Notifications NotificationFlash::widget()")](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-4.png)

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

[![alt text](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-5.png "Notifications NotificationFlash::widget()")](https://raw.githubusercontent.com/rahulabs/yii2-toastr/master/screenshot/screenshot-5.png)

```
\Yii::$app->session->setFlash('warning', ['Error 1', 'Error 2', 'Error 3']);
\Yii::$app->session->setFlash('success', ['Error 1', 'Error 2', 'Error 3']);
```

Acceptable parameters
---------------------

[](#acceptable-parameters)

ParameterDefault valueAvailable valuesDescriptiontype`info``info`, `error`, `success`, `warning`Notification Typetitle------Notification Titlemessage`Simple javascript toast notifications`---Notification textoptions`[]`[More details...](https://github.com/CodeSeven/toastr)Additional options**Allowed type constants:**

```
TYPE_INFO = 'info'
TYPE_ERROR = 'error'
TYPE_SUCCESS = 'success'
TYPE_WARNING = 'warning'

```

**Available position constants:**

```
POSITION_TOP_RIGHT = 'toast-top-right';
POSITION_TOP_LEFT = 'toast-top-left';
POSITION_TOP_CENTER = 'toast-top-center';
POSITION_TOP_FULL_WIDTH = 'toast-top-full-width';

POSITION_BOTTOM_RIGHT = 'toast-bottom-right';
POSITION_BOTTOM_LEFT = 'toast-bottom-left';
POSITION_BOTTOM_CENTER = 'toast-bottom-center';
POSITION_BOTTOM_FULL_WIDTH = 'toast-bottom-full-width';

```

Demonstration
-------------

[](#demonstration)

- Demo can be found at

Additionally
------------

[](#additionally)

- [Toastr by CodeSeven](https://github.com/CodeSeven/toastr)
- [Yii PHP Framework Version 2](https://github.com/yiisoft/yii2)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance41

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

646d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4083835b596a398908dd0bc60c9271d78904e1f66400c42b60994f39558722ae?d=identicon)[rahulabstain](/maintainers/rahulabstain)

---

Top Contributors

[![rahulabs](https://avatars.githubusercontent.com/u/6480804?v=4)](https://github.com/rahulabs "rahulabs (7 commits)")

---

Tags

notificationjqueryyii2extensiontoastr

### Embed Badge

![Health badge](/badges/rahulabs-yii2-toastr/health.svg)

```
[![Health](https://phpackages.com/badges/rahulabs-yii2-toastr/health.svg)](https://phpackages.com/packages/rahulabs-yii2-toastr)
```

###  Alternatives

[kartik-v/yii2-widget-growl

A widget to generate growl based notifications using bootstrap-growl plugin (sub repo split from yii2-widgets)

384.2M14](/packages/kartik-v-yii2-widget-growl)[kartik-v/yii2-widget-alert

A widget to generate alert based notifications using bootstrap-alert plugin (sub repo split from yii2-widgets)

284.1M24](/packages/kartik-v-yii2-widget-alert)[odaialali/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.

1486.3k](/packages/odaialali-yii2-toastr)[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[diecoding/yii2-toastr

Simple flash toastr notifications for Yii2

1328.8k](/packages/diecoding-yii2-toastr)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
