PHPackages                             sargilla/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sargilla/toastr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sargilla/toastr
===============

Toastr - Flash Messages for Laravel 5

v2.1.3(3w ago)0246MITPHPPHP ^8.2

Since Feb 9Pushed 3w agoCompare

[ Source](https://github.com/sargilla/toastr)[ Packagist](https://packagist.org/packages/sargilla/toastr)[ Docs](https://github.com/sargilla/toastr)[ RSS](/packages/sargilla-toastr/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Toastr - Flash Messages for Laravel 5
=====================================

[](#toastr---flash-messages-for-laravel-5)

Simple flash messagges system to use with Laravel 5 Framework. By default it relies on twitter bootstrap "alert" component. You can display multiple flash messages in different types (success, info, warning, danger) at once and to each message you can asign some custom params that will allow you for example mark some of them as important etc.

---

- [Installation](#installation)
- [Registering the Package](#registering-the-package)
- [Usage](#usage)

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

[](#installation)

#### Via composer require command

[](#via-composer-require-command)

Use [composer](http://getcomposer.org) require command to install this package.

```
$ composer require sargilla/toastr
```

#### Laravel version Compatibility

[](#laravel-version-compatibility)

LaravelPackage5.0.x1.0.x5.1.x1.0.x5.2.x2.0.x5.3.x2.0.x5.4.x2.0.x7.0.x2.0.x#### Adding package to composer.json file manually

[](#adding-package-to-composerjson-file-manually)

Add package to your composer.json file:

```
"require": {
  "sargilla/toastr": "2.0.*"
}

```

Use [composer](http://getcomposer.org) update command to install this package.

```
$ composer update
```

### Registering the Package

[](#registering-the-package)

Add the Toastr Service Provider to your config in `config/app.php`:

```
'providers' => array(
	Sargilla\Toastr\Providers\ToastrServiceProvider::class,
),
```

and create an alias:

```
'aliases' => [
    'Toastr'    => Sargilla\Toastr\Facades\Toastr::class,
],
```

Usage
-----

[](#usage)

First of all you need to add some code to your view scripts. In most cases it will be layout file (or other place where you want to flash message be displayed). You can use default view script distrubuted within this package by adding following code into your view file:

```
@include('toastr::alerts')
```

or to gain more controll of the look and feel of your flash messages you can start with using following template (just copy and paste it into a place where your application allerts should be displayed):

```
@if(Session::has('toastr.alerts'))

    @foreach(Session::get('toastr.alerts') as $alert)

            &times;

            @if( ! empty($alert['title']))
                {{ $alert['title'] }}
            @endif

            {{ $alert['message'] }}

            @if(array_get($alert,'params.important')) (This alert is marked as important) @endif

    @endforeach

@endif
```

In your controllers/action before you perform a redirect:

```
public function login()
{
	Toastr::success('Welcom back!')->push();
    return Redirect::home();
}
```

you can push more than one alert at once:

```
public function login()
{
	Toastr::success('Welcom back!')->push();
	Toastr::warning('You don\'t look too good today!')->push();

    return Redirect::home();
}
```

Other usage examples:

```
// using alert() method - first param is an alert type socond one is a message:
Toastr::alert('danger','Error - generated by alert() method')->push();
Toastr::alert('danger','Error - generated by alert() method')->push();
Toastr::alert('info','Info - generated by alert() method')->push();
Toastr::alert('warning','Warning - generated by alert() method')->push();
Toastr::alert('success','Success - generated by alert() method')->push();

// error alert with title
Toastr::alert('danger',['Some title','Error - generated by alert() method'])->push();

// succes
Toastr::success('This is success')->push();

// success with title
Toastr::success('Excelent','This is success')->push();

// info
Toastr::info('That is just short info')->push();

// warning
Toastr::warning('Thats a warning!')->push();

// error
Toastr::danger('We got an error!')->push();

// adding additional params to each alert (with() method allows you to pass some custom params that can be used later in a view script)
Toastr::danger('We got an error! And its marked as important')->with(['important' => true])->push();
Toastr::danger('We got an error!', 'But its not that important')->with(['important' => false])->push();
```

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 60% 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 ~691 days

Recently: every ~863 days

Total

6

Last Release

24d ago

Major Versions

1.0.1 → 2.0.02017-02-09

PHP version history (3 changes)1.0.1PHP &gt;=5.3.0

2.1.0PHP &gt;=7.2.5

v2.1.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/da8e2a69f7c9ddb844e33fd89a9e9be3039303688c90af5ce498b0ec4dddd9cb?d=identicon)[sargilla](/maintainers/sargilla)

---

Top Contributors

[![sargilla](https://avatars.githubusercontent.com/u/263582?v=4)](https://github.com/sargilla "sargilla (6 commits)")[![artdarek](https://avatars.githubusercontent.com/u/1362351?v=4)](https://github.com/artdarek "artdarek (3 commits)")[![ptrstovka](https://avatars.githubusercontent.com/u/5551894?v=4)](https://github.com/ptrstovka "ptrstovka (1 commits)")

---

Tags

laravel 5alertstoastrflash-messages

### Embed Badge

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

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

###  Alternatives

[illuminate/pagination

The Illuminate Pagination package.

12234.6M1.1k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9350.2M312](/packages/illuminate-pipeline)[illuminate/cookie

The Illuminate Cookie package.

224.7M146](/packages/illuminate-cookie)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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