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

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

laracasts/flash
===============

Easy flash notifications

3.2.6(3mo ago)2.8k16.5M↓16.6%356[23 issues](https://github.com/laracasts/flash/issues)[15 PRs](https://github.com/laracasts/flash/pulls)20MITPHPPHP &gt;=5.4.0CI failing

Since Jun 30Pushed 3mo ago69 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (23)Used By (20)

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

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

This composer package offers a Twitter Bootstrap optimized flash messaging setup for your Laravel applications.

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

[](#installation)

Begin by pulling in the package through Composer.

```
composer require laracasts/flash
```

Next, as noted above, the default CSS classes for your flash message are optimized for Twitter Bootstrap. As such, either pull in the Bootstrap's CSS within your HTML or layout file, or write your own CSS based on these classes.

```

```

Usage
-----

[](#usage)

Within your controllers, before you perform a redirect, make a call to the `flash()` function.

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

    return home();
}
```

You may also do:

- `flash('Message')->success()`: Set the flash theme to "success".
- `flash('Message')->error()`: Set the flash theme to "danger".
- `flash('Message')->warning()`: Set the flash theme to "warning".
- `flash('Message')->overlay()`: Render the message as an overlay.
- `flash()->overlay('Modal Message', 'Modal Title')`: Display a modal overlay with a title.
- `flash('Message')->important()`: Add a close button to the flash message.
- `flash('Message')->error()->important()`: Render a "danger" flash message that must be dismissed.

With this message flashed to the session, you may now display it in your view(s). Because flash messages and overlays are so common, we provide a template out of the box to get you started. You're free to use - and even modify to your needs - this template how you see fit.

```
@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 --provider="Laracasts\Flash\FlashServiceProvider"
```

The two package views will now be located in the `resources/views/vendor/flash/` directory.

```
flash('Welcome Aboard!');

return home();
```

```
flash('Sorry! Please try again.')->error();

return home();
```

```
flash()->overlay('You are now a Laracasts member!', 'Yay');

return home();
```

> [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.

Multiple Flash Messages
-----------------------

[](#multiple-flash-messages)

Need to flash multiple flash messages to the session? No problem.

```
flash('Message 1');
flash('Message 2')->important();

return redirect('somewhere');
```

Done! You'll now see two flash messages upon redirect.

###  Health Score

71

—

ExcellentBetter than 100% of packages

Maintenance81

Actively maintained with recent releases

Popularity75

Solid adoption and visibility

Community55

Growing community involvement

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 63.3% 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 ~204 days

Recently: every ~287 days

Total

22

Last Release

100d ago

Major Versions

1.3.4 → 2.0.02016-03-14

2.0.1 → 3.0.02017-04-26

### Community

Maintainers

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

---

Top Contributors

[![JeffreyWay](https://avatars.githubusercontent.com/u/183223?v=4)](https://github.com/JeffreyWay "JeffreyWay (69 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![shaneparsons](https://avatars.githubusercontent.com/u/5495493?v=4)](https://github.com/shaneparsons "shaneparsons (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)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (2 commits)")[![jpuck](https://avatars.githubusercontent.com/u/15305396?v=4)](https://github.com/jpuck "jpuck (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)")[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (1 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![jonnott](https://avatars.githubusercontent.com/u/472468?v=4)](https://github.com/jonnott "jonnott (1 commits)")[![tomschlick](https://avatars.githubusercontent.com/u/70184?v=4)](https://github.com/tomschlick "tomschlick (1 commits)")[![kezadias](https://avatars.githubusercontent.com/u/5727111?v=4)](https://github.com/kezadias "kezadias (1 commits)")[![landrok](https://avatars.githubusercontent.com/u/3310446?v=4)](https://github.com/landrok "landrok (1 commits)")[![dbpolito](https://avatars.githubusercontent.com/u/347400?v=4)](https://github.com/dbpolito "dbpolito (1 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (1 commits)")[![markwalet](https://avatars.githubusercontent.com/u/11446771?v=4)](https://github.com/markwalet "markwalet (1 commits)")[![MarnuLombard](https://avatars.githubusercontent.com/u/2191786?v=4)](https://github.com/MarnuLombard "MarnuLombard (1 commits)")[![minkbear](https://avatars.githubusercontent.com/u/233714?v=4)](https://github.com/minkbear "minkbear (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[illuminate/mail

The Illuminate Mail package.

5910.6M498](/packages/illuminate-mail)[illuminate/notifications

The Illuminate Notifications package.

513.1M1.1k](/packages/illuminate-notifications)

PHPackages © 2026

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