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

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

danganf/laracasts-flash
=======================

Easy flash notifications

2.0.3(8y ago)05021MITPHPPHP &gt;=5.4.0

Since Jun 30Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (13)Used By (1)

Easy Flash Messages for Your Laravel App
========================================

[](#easy-flash-messages-for-your-laravel-app)

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

[](#installation)

First, pull in the package through Composer.

Run `composer require laracasts/flash`

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

```
'providers' => [
    Laracasts\Flash\FlashServiceProvider::class,
];
```

Usage
-----

[](#usage)

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

```
public function store()
{
    flash('Welcome Aboard!');

    return home();
}
```

You may also do:

- `flash('Message', 'info')`
- `flash('Message', 'success')`
- `flash('Message', 'danger')`
- `flash('Message', 'warning')`
- `flash()->overlay('Modal Message', 'Modal Title')`
- `flash('Message')->important()`

Behind the scenes, this will set a few keys in the session:

- 'flash\_notification.message' - The message you're flashing
- 'flash\_notification.level' - A string that represents the type of notification (good for applying HTML class names)

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

```
@if (session()->has('flash_notification.message'))

        &times;

        {!! session('flash_notification.message') !!}

@endif
```

> 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('flash::message')
```

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('Welcome Aboard!');

return 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('Sorry! Please try again.', 'danger');

return 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('Notice', 'You are now a Laracasts member!');

return home();
```

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

> [Learn exactly how to build this very package on Laracasts!](https://laracasts.com/lessons/flexible-flash-messages)

Hiding Flash Messages
---------------------

[](#hiding-flash-messages)

A common desire is to display a flash message for a few seconds, and then hide it. To handle this, write a simple bit of JavaScript. For example, using jQuery, you might add the following snippet just before the closing `` tag.

```

$('div.alert').not('.alert-important').delay(3000).fadeOut(350);

```

This will find any alerts - excluding the important ones, which should remain until manually closed by the user - wait three seconds, and then fade them out.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 55.9% 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 ~104 days

Recently: every ~153 days

Total

12

Last Release

3179d ago

Major Versions

1.3.4 → 2.0.02016-03-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/41fa09b45a72c468bc9df91cc90c0dd39e92d70f0ef136c8dce5f2dc9a141ff8?d=identicon)[danganf](/maintainers/danganf)

---

Top Contributors

[![JeffreyWay](https://avatars.githubusercontent.com/u/183223?v=4)](https://github.com/JeffreyWay "JeffreyWay (33 commits)")[![shaneparsons](https://avatars.githubusercontent.com/u/5495493?v=4)](https://github.com/shaneparsons "shaneparsons (3 commits)")[![danganf](https://avatars.githubusercontent.com/u/5049091?v=4)](https://github.com/danganf "danganf (3 commits)")[![zablose](https://avatars.githubusercontent.com/u/8734335?v=4)](https://github.com/zablose "zablose (2 commits)")[![chaot1xMD](https://avatars.githubusercontent.com/u/36856151?v=4)](https://github.com/chaot1xMD "chaot1xMD (2 commits)")[![LordMilutin](https://avatars.githubusercontent.com/u/76582100?v=4)](https://github.com/LordMilutin "LordMilutin (2 commits)")[![quickliketurtle](https://avatars.githubusercontent.com/u/1762128?v=4)](https://github.com/quickliketurtle "quickliketurtle (2 commits)")[![Schnoop](https://avatars.githubusercontent.com/u/1263407?v=4)](https://github.com/Schnoop "Schnoop (1 commits)")[![sergiogregorutti](https://avatars.githubusercontent.com/u/3071996?v=4)](https://github.com/sergiogregorutti "sergiogregorutti (1 commits)")[![thoresuenert](https://avatars.githubusercontent.com/u/382395?v=4)](https://github.com/thoresuenert "thoresuenert (1 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (1 commits)")[![waiyan112](https://avatars.githubusercontent.com/u/3263761?v=4)](https://github.com/waiyan112 "waiyan112 (1 commits)")[![kezadias](https://avatars.githubusercontent.com/u/5727111?v=4)](https://github.com/kezadias "kezadias (1 commits)")[![codeclown](https://avatars.githubusercontent.com/u/211543?v=4)](https://github.com/codeclown "codeclown (1 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![hpakdaman](https://avatars.githubusercontent.com/u/9606809?v=4)](https://github.com/hpakdaman "hpakdaman (1 commits)")[![imknight](https://avatars.githubusercontent.com/u/77604?v=4)](https://github.com/imknight "imknight (1 commits)")[![andrewturner](https://avatars.githubusercontent.com/u/60941?v=4)](https://github.com/andrewturner "andrewturner (1 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/danganf-laracasts-flash/health.svg)](https://phpackages.com/packages/danganf-laracasts-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)[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)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[illuminate/mail

The Illuminate Mail package.

5910.1M390](/packages/illuminate-mail)

PHPackages © 2026

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