Download the PHP package neoflow/flash without Composer
On this page you can find all versions of the php package neoflow/flash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neoflow/flash
More information about neoflow/flash
Files in neoflow/flash
Package flash
Short Description Flash service for Slim 4 and similar PSR-15 compliant frameworks and apps.
License MIT
Informations about the package flash
This project is no longer maintained.
Please use other solutions for flash messages with PHP.
Flash
Flash service for Slim 4 and similar PSR-15 compliant frameworks and apps.
Table of Contents
- Requirement
- Installation
- Configuration
- Usage
- Session
- Contributors
- History
- License
Requirement
- PHP >= 7.3
Installation
You have 2 options to install this library.
Via Composer...
...or manually download the latest release from here.
Configuration
The following instructions based on Slim 4, in combination with PHP-DI, but should be adaptable for any PSR-11/PSR-15 compliant frameworks and libraries.
Add the service Neoflow\Flash\Flash
and middleware Neoflow\Flash\Middleware\FlashMiddleware
to the container definitions...
...and register the middleware, to use the session as storage for the values.
Please note The session has to start first, before the middleware can get successfully dispatched.
Alternatively, you can also load values from another storage than the session with a closure middleware...
...or add it directly in the container definitions and skip the middleware.
When your DI container supports inflectors (e.g. league/container),
you can optionally register Neoflow/Flash/FlashAwareInterface
as inflector to your container definition.
Additionally, you can also use Neoflow/Flash/FlashAwareTrait
as a shorthand implementation of
Neoflow/Flash/FlashAwareInterface
.
Usage
The service Neoflow\Flash\Flash
provides the most needed methods to get access to the values for the
current request and to add values for the next request.
For more advanced use cases, you can also get and set the values for current and next request.
Nice to know
Version 2.0 has been simplified and the message handling implementation has been removed. If you need the message handling please keep using version 1.2.
In earlier times, the library was also part of Neoflow\Session and then moved into a standalone library, to comply with the design principle of separation of concerns.
If you want to use a session service, you can easily combine both libraries as composer packages. The integration and usage of Neoflow\Session is very similar to the current library.
Contributors
- Jonathan Nessier, Neoflow
If you would like to see this library develop further, or if you want to support me or show me your appreciation, please donate any amount through PayPal. Thank you! :beers:
License
Licensed under MIT.
Made in Switzerland with :cheese: and :heart: