Skip to content

perials/php-session-class-with-flash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

A PHP Session class with flash (next request only) data

Installation

require 'session.php';
$session = new Session();

Set new or update existing session variable

$session->set('name', 'value');
$session->set('name', ['value_1','value_2']);

Get session variable value

$value = $session->get('name');
//returns null if 'name' wasn't set

If given session variable not found then get returns null.

Flashing data

Flashing a session means the session variable will be available only for next request. This is particularly useful for showing form validation error.

$session->flash('error', 'Username/Password incorrect');

Retrieving the flash data

Getting the flash data is same as getting any other session variable

$error = $session->get('error');

About

A PHP Session class with flash (next request only) data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages