Skip to content

dantodev/php-flash-messages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version License Build Status

PHP flash messages

Session flash messages for PHP

Dependencies

  • PHP >= 5.6.0

Installation

Install with Composer:

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.

Methods

get($type, $key, $default = null)

Returns message with given $type and $key from last call or $default if there is no message.

or call with predefined type:

  • getError($key, $default = null)
  • getWarning($key, $default = null)
  • getSuccess($key, $default = null)
  • getInfo($key, $default = null)

has($type, $key)

Determine if there is any message with given $type and $key from last call.

or call with predefined type:

  • hasError($key)
  • hasWarning($key)
  • hasSuccess($key)
  • hasInfo($key)

set($type, $key, $value)

Save message with given $type and $key to store for next call.

or call with predefined type:

  • setError($key, $value)
  • setWarning($key, $value)
  • setSuccess($key, $value)
  • setInfo($key, $value)

remove($type, $key)

Remove message with given $type and $key from store for next call.

or call with predefined type:

  • removeError($key)
  • removeWarning($key)
  • removeSuccess($key)
  • removeInfo($key)

removeAll($type)

Remove all messages with given $type from store for next call.

or call with predefined type:

  • removeError($key)
  • removeWarning($key)
  • removeSuccess($key)
  • removeInfo($key)

getAll($type)

Return an array of all messages with given $type from last call.

or call with predefined type:

  • getAllError()
  • getAllWarning()
  • getAllSuccess()
  • getAllInfo()

getAllTypes()

Return an array of all types and their messages from last call.

hasAny($type)

Determine if there is any messages with given $type from last call.

or call with predefined type:

  • hasAnyError()
  • hasAnyWarning()
  • hasAnySuccess()
  • hasAnyInfo()

About

Session flash messages for PHP

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages