PHPackages                             mtxr/laravel-flash-message - 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. mtxr/laravel-flash-message

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

mtxr/laravel-flash-message
==========================

Flash Messages made easy. Based on laracasts/flash

38441PHP

Since Sep 14Pushed 9y agoCompare

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

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Flash messages made easy. Based on laracasts/flash
==================================================

[](#flash-messages-made-easy-based-on-laracastsflash)

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

[](#installation)

First, pull in the package through Composer.

Run `composer require mtxr/laravel-flash-message`

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

```
'providers' => [
    FlashMessage\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('Message')->important()`

Adding Icons:

- `flash('Message')->icon('fa fa-exclamation-circle')`

Deleting last message:

- `flash()->delete()`

Clearing message queue:

- `flash()->clear()`

If you need, you can flash two messages in the same request:

```
public function welcome()
{
    flash('Welcome Aboard!', 'success');

    flash('Request Failed!', 'error');

    return home();
}
```

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

- 'flash\_notification.messages' - The array of messages you have

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

```
@if (session()->has('flash_notification.messages'))
    @foreach(session('flash_notification.messages') as $messageData)

    @if(!$messageData['important'])
        &times;
    @endif

        {!! trans($messageData['message']) !!}

    @endforeach
@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...

```

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

```
php artisan vendor:publish
```

The package view will now be located in the `app/views/packages/mtxr/laravel-flash-message/` directory.

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.

```

$('.flash-message.alert').not('.alert-important').delay(5000).slideUp(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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/880e51f04e025e0de8c236dc8543c4e4839dfdd74523515357d744ce8d447cd3?d=identicon)[mtxr](/maintainers/mtxr)

---

Top Contributors

[![JeffreyWay](https://avatars.githubusercontent.com/u/183223?v=4)](https://github.com/JeffreyWay "JeffreyWay (33 commits)")[![mtxr](https://avatars.githubusercontent.com/u/707561?v=4)](https://github.com/mtxr "mtxr (19 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)")[![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)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (1 commits)")[![kezadias](https://avatars.githubusercontent.com/u/5727111?v=4)](https://github.com/kezadias "kezadias (1 commits)")[![waiyan112](https://avatars.githubusercontent.com/u/3263761?v=4)](https://github.com/waiyan112 "waiyan112 (1 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1 commits)")[![andrewturner](https://avatars.githubusercontent.com/u/60941?v=4)](https://github.com/andrewturner "andrewturner (1 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)")[![codeclown](https://avatars.githubusercontent.com/u/211543?v=4)](https://github.com/codeclown "codeclown (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)")[![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)")

### Embed Badge

![Health badge](/badges/mtxr-laravel-flash-message/health.svg)

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

###  Alternatives

[grasmash/composerize-drupal

Convert a non-Composer managed Drupal application into a Composer-managed application.

12819.4k1](/packages/grasmash-composerize-drupal)[neutron/signal-handler

A library to ease the use of signal handling.

13101.4k2](/packages/neutron-signal-handler)

PHPackages © 2026

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