conquest / flash
This is my package flash
Fund package maintenance!
Conquest
Requires
- php: ^8.1
- conquest/core: ^0.3.2
- illuminate/session: ^10.0||^11.0
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
README
Flash exposes a global flash
helper, which allows you to easily add flash messages to your session. These messages can be passed to your frontend using the HandleInertiaRequests
middleware, see the usage section for more information.
Installation
You can install the package via composer:
composer require conquest/flash
Usage
The package ships with a global flash
helper. Call this helper with a message to add flash messages to the session. You can configure the message, description and type. Two classes are provided which can be added separately. The Toast
class allows for a duration to be set, a Banner
class has no duration and will remain until dismissed.
If not specified, the flash message is assumed to be a Toast
.
flash('Hello, World!') flash()->toast('Hello, World!') flash()->banner('Hello, world!')
To pass this to an Inertia frontend, add the following to the HandleInertiaRequests
middleware array:
'flash' => Flash::messages(),
It is important to use the flash
key if you intend on using the Vue + Inertia plugin.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.