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

2.1.1(4y ago)0228MITPHPPHP &gt;=7.2.5

Since Feb 9Pushed 4y 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 today

READMEChangelogDependenciesVersions (5)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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~573 days

Total

4

Last Release

1656d ago

Major Versions

1.0.1 → 2.0.02017-02-09

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

2.1.0PHP &gt;=7.2.5

### 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 (4 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

[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)[leantony/laravel-grid

A grid view for laravel, inspired by the yii2 grid widget

9060.2k](/packages/leantony-laravel-grid)[danielme85/laravel-cconverter

Laravel 5 plug-in for currency conversion

42101.1k](/packages/danielme85-laravel-cconverter)[tatter/alerts

Lightweight user alerts for CodeIgniter 4

4072.4k6](/packages/tatter-alerts)[cartalyst/alerts

Alerts allows you to easily pass alert messages to your Laravel views.

3064.2k](/packages/cartalyst-alerts)[softon/sweetalert

Laravel 5 Package for SweetAlert2. Use this package to easily show sweetalert2 prompts in your laravel app.

2936.1k1](/packages/softon-sweetalert)

PHPackages © 2026

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