Download the PHP package joefallon/phpflash without Composer
On this page you can find all versions of the php package joefallon/phpflash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joefallon/phpflash
More information about joefallon/phpflash
Files in joefallon/phpflash
Package phpflash
Short Description A simple library for flash messages.
License MIT
Homepage https://github.com/joefallon/phpflash
Informations about the package phpflash
phpflash
By Joe Fallon
The flash is a special part of the session which is cleared with each request. This means that values stored there will only be available in the next request. This is useful for passing error/success/warning/info messages to the user.
This library has the following features:
- Fully unit tested.
- Allows flash message to be stored in either the session or in a temporary variable.
- They following types of flash messages can be stored: info, warning, success, and error.
Installation
The easiest way to install PHP Flash is with
Composer. Create the following composer.json
file
and run the php composer.phar install
command to install it.
Usage
Types of Messages
Working with Messages in the Session
To load and clear the messages that are in the session call the following:
Calling #loadMessagesFromSession is required because once PHP begins sending the page data back to the client, the session can no longer be accessed.
Info Messages
Success Messages
Warning Messages
Error Messages
Example Usage on Two Separate Page Requests
later on the next request...
Example Usage on the Same Page Request
later on in the same request...