PHPackages                             znck/flash - 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. znck/flash

Abandoned → [laracasts/flash](/?search=laracasts%2Fflash)Library[Mail &amp; Notifications](/categories/mail)

znck/flash
==========

Easy flash notifications for laravel 5

v1.2.6(10y ago)11891MITPHPPHP &gt;=5.4.0

Since Apr 2Pushed 10y ago1 watchersCompare

[ Source](https://github.com/znck/flash)[ Packagist](https://packagist.org/packages/znck/flash)[ Docs](https://github.com/znck/flash)[ RSS](/packages/znck-flash/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (0)

Flash [![](https://camo.githubusercontent.com/61a046dba4163e817c82778579d167419829124192312c5747fc1c9c62af994a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7a6e636b2f666c6173682e737667)](https://travis-ci.org/znck/flash) [![](https://camo.githubusercontent.com/31161ed6a4f7ee67398f67ba283cfa30c4ce6097dba9aec007faed6a3fc0cf95/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7a6e636b2f666c6173682e737667)](https://github.com/znck/flash/releases) [![](https://camo.githubusercontent.com/49fd9bf93040f300a900f5e4a50472c290bd795b2cabb4c1fd3f1c72b0e29429/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6e636b2f666c6173682e737667)](https://packagist.org/packages/znck/flash) [![](https://camo.githubusercontent.com/d5bffe441d256e69a1a6d22fe9c6bc5cc13fd8d432ed4dc51104312b80bf106f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6e636b2f666c6173682e737667)](https://packagist.org/packages/znck/flash) [![](https://camo.githubusercontent.com/cb50a6ca4c3b45cae46cb300980ab2dbf170fd6eae1c3bea259279359b598ac1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a6e636b2f666c6173682e737667)](http://znck.mit-license.org) [![](https://camo.githubusercontent.com/92f402dfec0fdd0fbd1f34d075bb52df6c0b0b1c8bdc550e39ca8e8543821499/68747470733a2f2f7777772e636f646163792e636f6d2f70726f6a6563742f62616467652f3030356333363639653537343432613139386633613466666535653563396532)](https://www.codacy.com/app/hi_3/flash)
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#flash-------)

Easy flash notifications for Laravel 5

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

[](#installation)

First, pull in the package through Composer.

```
"require": {
    "znck/flash": "~1.2"
}
```

And then, if using Laravel 5, include the service provider within `app/config/app.php`.

```
'providers' => [
    'Znck\Flash\FlashServiceProvider'
];
```

And, for convenience, add a facade alias to this same file at the bottom:

```
'aliases' => [
    'Flash' => 'Znck\Flash\Flash'
];
```

Usage
-----

[](#usage)

Within your controllers, before you perform a redirect...

```
public function store()
{
    Flash::message('Welcome Aboard!');

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

You may also do:

- `Flash::info('Message')`
- `Flash::success('Message')`
- `Flash::error('Message')`
- `Flash::warning('Message')`
- `Flash::overlay('Modal Message', 'Modal Title')`

This will set a few keys in the session:

- 'znck.flash.notifications' - Session key for flash notification's message bag

Each message will have these keys:

- 'message' - The message you're flashing
- 'level' - A string that represents the HTML class for displaying the message
- 'sort' - Level weight used to sort the messages.

Alternatively, again, you may reference the `flash()` helper function, instead of the facade. Here's an example:

```
/**
 * Destroy the user's session (logout).
 *
 * @return Response
 */
public function destroy()
{
    Auth::logout();

    flash()->success('You have been logged out.');

    return home();
}

```

Or, for a general information flash, just do: `flash('Some message');`.

With this message flashed to the session, you may now display it in your view(s). Maybe something like:

```
@foreach(flash()->get() as $notification)

        &times;

        {!! $notification['message'] !!}

@endforeach
```

You may also do:

- Flash::get()
- flash()-&gt;get()

`Flash::get()` or `flash()->get()` function can take an optional variable to filter the result. Eg:

```
php
Flash::get('*'); // To get all messages.
Flash::get('info'); // To get only messages with info level.
Flash::get('info|warning'); // To get messages with info or warning level

```

You can publish the config file to add custom message levels and reorder messages.

```
// Default messagle levels and their sort order
[
    'classes' => [
        'error'   => 'danger',
        'warning' => 'warning',
        'success' => 'success',
        'info'    => 'info',
    ],

    'levels'  => [
        'error'   => 400,
        'warning' => 300,
        'success' => 200,
        'info'    => 100,
    ]
];
```

> Note that this package is optimized for use with Twitter Bootstrap.

Because flash messages and overlays are so common, if you want, you may use (or modify) the views that are included with this package. Simply append to your layout view:

```
@include('znck::flash.notifications')
```

Example
-------

[](#example)

```
>

    Document

    @include('flash::message')

    Welcome to my website...

    $('#flash-overlay-modal').modal();

```

If you need to modify the flash message partials, you can run:

```
php artisan vendor:publish
```

The two package views will now be located in the `app/views/packages/laracasts/flash/' directory.

```
Flash::message('Welcome aboard!');

return Redirect::home();
```

[![https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/message.png](https://camo.githubusercontent.com/ea8b3221a5ac8f1dd24ce31888dfb406fb500576b08f27cdd947f0f363e0eaad/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6d6573736167652e706e67)](https://camo.githubusercontent.com/ea8b3221a5ac8f1dd24ce31888dfb406fb500576b08f27cdd947f0f363e0eaad/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6d6573736167652e706e67)

```
Flash::error('Sorry! Please try again.');

return Redirect::home();
```

[![https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/error.png](https://camo.githubusercontent.com/f772165d97c60686d8bc5279dde14eebb2e570d333f4721b975928bf722405ba/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6572726f722e706e67)](https://camo.githubusercontent.com/f772165d97c60686d8bc5279dde14eebb2e570d333f4721b975928bf722405ba/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6572726f722e706e67)

```
Flash::overlay('You are now a Laracasts member!');

return Redirect::home();
```

[![https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/overlay.png](https://camo.githubusercontent.com/97b6fa964c2ff2a81eb3142d61137101cfe4bdb6f6dcbde8c094e604b451b540/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6f7665726c61792e706e67)](https://camo.githubusercontent.com/97b6fa964c2ff2a81eb3142d61137101cfe4bdb6f6dcbde8c094e604b451b540/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f3737343835392f4769744875622d5265706f732f666c6173682f6f7665726c61792e706e67)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~31 days

Recently: every ~70 days

Total

10

Last Release

3779d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79c0b664c035ee2af1f8988190a505d9fd559649b56711d31670f6717e3ec441?d=identicon)[znck](/maintainers/znck)

---

Top Contributors

[![znck](https://avatars.githubusercontent.com/u/2596484?v=4)](https://github.com/znck "znck (29 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/znck-flash/health.svg)

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[brian2694/laravel-toastr

toastr.js for Laravel

136649.4k5](/packages/brian2694-laravel-toastr)[edvinaskrucas/notification

Package for Laravel for helping to manage flash / instant notifications / messages.

520393.9k10](/packages/edvinaskrucas-notification)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)

PHPackages © 2026

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