tonning / flash
Flash for Laravel
Fund package maintenance!
tonning
Installs: 11 599
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- illuminate/contracts: ^8.37 || ^9.0|^10.0
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- nunomaduro/collision: ^5.3|^7.0
- orchestra/testbench: ^6.15|^8.5
- pestphp/pest: ^1.18|^2.16
- pestphp/pest-plugin-laravel: ^1.1|^2.2
- spatie/laravel-ray: ^1.23
- vimeo/psalm: ^4.8|^5.15
README
This composer package offers a Tailwind optimized flash messaging setup for your Laravel applications.
Installation
You can install the package via composer:
composer require tonning/flash
You can publish the view files with:
php artisan vendor:publish --provider="Tonning\Flash\FlashServiceProvider" --tag="flash-views"
You can publish the config file with:
php artisan vendor:publish --provider="Tonning\Flash\FlashServiceProvider" --tag="flash-config"
This is the contents of the published config file:
return [ 'display_errors' => true, ];
Usage
Anywhere in your application you can added a flash notification.
use Tonning\Flash\Flash; Flash::info('A new software update is available. See what’s new in version 2.0.4.');
Displaying notifications
@if(flash()->hasAny()) {!! flash() !!} @endif
Titles
You can also provide a title to your notifications that will be displayed along with it.
use Tonning\Flash\Flash; Flash::warning('Please confirm your email address.', 'Attention needed');
Grouping
Notifications of the same type will be grouped in an unordered list.
use Tonning\Flash\Flash; Flash::warning('Facilisis himenaeos nullam habitasse lacus sem auctor.'); Flash::warning('Please confirm your email address.', 'Attention needed'); Flash::warning('Facilisis egestas fermentum porttitor sapien eleifend amet.');
Errors
This package will by default also display any validation errors.
throw ValidationException::withMessages(['Something went wrong.']);
This can be turned of in the config file.
'display_errors' => false,
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.