Download the PHP package wp-kit/flash without Composer
On this page you can find all versions of the php package wp-kit/flash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package flash
Short Description A wp-kit component that handles frontend and admin flash notifications
License MIT
Homepage https://github.com/wp-kit/flash
Informations about the package flash
wp-kit/flash
This is a wp-kit component that handles both frontend and admin flash notifications.
This component was built to run within an so is perfect for frameworks such as , and .
Often, Wordpress developers want to be able to use a single component the handle flashes stored in the session and their output to the client, usually after a redirect.
In Wordpress we do have the ability to forge admin notices via some hooks but there a few hoops to jump through in that you have to write quite a bit of code to handle the session storage and the output, and currently there are no hooks for front-end flashes.
Installation
If you're using , install via in the route folder, otherwise install in your driven theme folder:
Setup
Add Service Provider
Just register the service provider and facade in your providers config:
Add Facade
If you are using Themosis or another driven framework, you may want to add , simply add them to your aliases:
Add Config & View File(s)
Although a config file is not required for , we do need to publish view files and a config is needed for your .
The recommended method of installing config files for components is via command.
First, install WP CLI, and then install this component, will automatically be installed with , once installed you can run:
For more information, please visit .
Alternatively, you can place the view file(s) in your and directories manually.
Usage
Note: automatically outputs notices in admin area using the hook .
Important Don't forget to use the middleware to ensure flashes persist.
Using Facades
Using Helper Function
Looping through messages
This is just a guide of how you use use when looping through a load of flashes where you need to output markup around each flash:
Get Involved
To learn more about how to use check out the docs:
Any help is appreciated. The project is open-source and we encourage you to participate. You can contribute to the project in multiple ways by:
- Reporting a bug issue
- Suggesting features
- Sending a pull request with code fix or feature
- Following the project on GitHub
- Sharing the project around your community
For details about contributing to the framework, please check the contribution guide.
Requirements
Wordpress 4+
PHP 5.6+
License
wp-kit/flash is open-sourced software licensed under the MIT License.
All versions of flash with dependencies
wp-kit/config Version 2.*
illuminate/session Version ^6.0
illuminate/view Version ^6.0
wp-kit/utils Version 2.*