Download the PHP package jalle19/laravel-unshitty-flash without Composer
On this page you can find all versions of the php package jalle19/laravel-unshitty-flash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jalle19/laravel-unshitty-flash
More information about jalle19/laravel-unshitty-flash
Files in jalle19/laravel-unshitty-flash
Package laravel-unshitty-flash
Short Description Highly opinionated flash message service for Laravel
License MIT
Informations about the package laravel-unshitty-flash
laravel-unshitty-flash
Highly opinionated flash message service for Laravel. In contrast to practically all other similar libraries I've seen, this one:
- Supports multiple messages
- Supports multiple identical messages
- Supports flashing immediately, i.e. to the current request
- Let's you configure the session key used
- Forces you to inject the service, no magic facade
- Forces you to operate on the
Requestobject itself
Installation
Install the package:
Register the service provider:
Publish the configuration file:
Usage
Inject FlashService into the controller you want to create flash messages from, then use it like this:
If you need to flash a message to the current request, (e.g. from a middleware that displays a permanent message), pass
true as the third parameter:
If the message levels above are not enough for you, you can use an arbitrary level using the message() method:
To render the flash messages in your views, you can use something like the following snippet:
All versions of laravel-unshitty-flash with dependencies
illuminate/support Version ^7.0|^8.0|^9.0
illuminate/http Version ^7.0|^8.0|^9.0
