Session

Internal Session helper class providing a simple get/set/reset interface to the Janitor Session storage. The Session class is automatically instanciated and globally available throught the session() reference function.

This class is included as default.

Functions

Session::value

Definition

Name
Session::value
Syntax
Void|String = Session::value( String $key [, Mixed $value ] );

Description

Get/Set function for internal Session storage. Use with only $key parameter to get the stored session value. Use $value parameter when update/set session value.

Parameters

$key
String Key for session value
$value
Mixed Optional Array/String value the set for Key

Returns

Void|String Void on set, String on get.

Examples

session()->value("user", "martin");

Will save the value "martin" for the key "user" in the internal session storage

session()->value("user");

Will return the value of the "user"-key in the internal session storage.

Uses

PHP
  • json_encode
  • json_decode
  • isset
Janitor

none

Session::reset

Definition

Name
Session::reset
Syntax
Void = Session::reset( [String $key] );

Description

Reset session key or entire session storage. If $key is omitted, entire storage will be unset.

Parameters

$key
String Optional Key to reset

Returns

Void

Examples

session()->reset("user");

Deletes the key "user" in the internal session storage

session()->reset();

Will reset the entire internal session storage.

Uses

PHP
  • session_unset
  • unset
Janitor

none