, (*1)
PHP flash messages
Session flash messages for PHP, (*2)
Dependencies
Installation
Install with Composer:, (*3)
composer require dtkahl/php-flash-messages
Usage
session_start();
$flash = new \Dtkahl\FlashMessages\FlashMessages;
**Warning:* Every new instance will be handled as new call and trunked data under given key in given store., (*4)
Methods
get($type, $key, $default = null)
Returns message with given $type and $key from last call or $default if there is no message., (*5)
or call with predefined type:
- getError($key, $default = null)
- getWarning($key, $default = null)
- getSuccess($key, $default = null)
- getInfo($key, $default = null), (*6)
has($type, $key)
Determine if there is any message with given $type and $key from last call., (*7)
or call with predefined type:
- hasError($key)
- hasWarning($key)
- hasSuccess($key)
- hasInfo($key), (*8)
set($type, $key, $value)
Save message with given $type and $key to store for next call., (*9)
or call with predefined type:
- setError($key, $value)
- setWarning($key, $value)
- setSuccess($key, $value)
- setInfo($key, $value), (*10)
remove($type, $key)
Remove message with given $type and $key from store for next call., (*11)
or call with predefined type:
- removeError($key)
- removeWarning($key)
- removeSuccess($key)
- removeInfo($key), (*12)
removeAll($type)
Remove all messages with given $type from store for next call., (*13)
or call with predefined type:
- removeError($key)
- removeWarning($key)
- removeSuccess($key)
- removeInfo($key), (*14)
getAll($type)
Return an array of all messages with given $type from last call., (*15)
or call with predefined type:
- getAllError()
- getAllWarning()
- getAllSuccess()
- getAllInfo(), (*16)
getAllTypes()
Return an array of all types and their messages from last call., (*17)
hasAny($type)
Determine if there is any messages with given $type from last call., (*18)
or call with predefined type:
- hasAnyError()
- hasAnyWarning()
- hasAnySuccess()
- hasAnyInfo(), (*19)