gnahotelsolutions/flasher

Flash notifications in Laravel
6,271 3
Install
composer require gnahotelsolutions/flasher
Latest Version:4.2.0
PHP:^8.2
License:MIT
Last Updated:Apr 7, 2026
Links: GitHub  ·  Packagist
Maintainer: lloople

Flasher

Latest Version on Packagist Total Downloads Software License

The gnahotelsolutions/flasher package provides an easy way to interact with flashed messages in your Laravel application.

Install

You can install the package via composer:

$ composer require gnahotelsolutions/flasher

Usage

The messages are stored in the notifications session key.

All notifications have a default duration property set to 5 seconds. You can use this property in your JavaScript to make notifications disappear automatically.

Creating notifications

Flasher::info("Welcome, {$user->name}");

Flasher::error('Incorrect password');

Flasher::warning('Remember to change your password');

Flasher::success('Password changed!');

If you want to use custom types, you can use the method createNotification

Flasher::createNotification('store', 'Someone bought a product!', null);

Check if there are pending notifications

@if (Flasher::any())
    <div class="alerts">
        ...
    </div>
@endif

Iterating over notifications

@foreach(Flasher::all() as $notification)
    <div class="alert alert-{{ $notification->getType() }}" data-duration="{{ $notification->getDuration() }}">
        {{ $notification->getMessage() }}
    </div> 
@endforeach

If you're using Bootstrap in your project, you can use getBootstrapClass() method. It will replace error with danger to match the framework's CSS class.

Testing

phpunit

Security

If you discover any security related issues, please email dllop@gna.es instead of using the issue tracker.

License

The MIT License (MIT).

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
4.2.0 ^8.2 ^10.0|^11.0|^12.0|^13.0 MIT
4.1.0 ^8.2 ^10.0|^11.0|^12.0 MIT
4.0.0 ^8.2 ^10.0|^11.0 MIT
3.1.0 ^7.1|^8.0|^8.1 ^5.7|^6.0|^7.0|^8.0|^9.0|^10.0 MIT
3.0.0 ^7.1|^8.0|^8.1 ^5.7|^6.0|^7.0|^8.0|^9.0 MIT