Session
in package
Provides access to get/set/delete session data.
Tags
Table of Contents
Methods
- delete() : void
- Delete a session variable.
- exists() : bool
- Check to see if a session exists.
- flash() : mixed
- "Flash" a session variable.
- get() : mixed
- Get a session variable.
- put() : void
- Create a new session variable.
Methods
delete()
Delete a session variable.
public
static delete(string $name) : void
Parameters
- $name : string
-
Contains the session variable name to delete.
exists()
Check to see if a session exists.
public
static exists(string $name) : bool
Parameters
- $name : string
-
Session variable name to check for.
Return values
boolflash()
"Flash" a session variable.
public
static flash(string $name[, string $string = '' ]) : mixed
The first time this is called, the variable is set, the second time it is retrieved + removed from session. Often used for temp success/error messages.
Parameters
- $name : string
-
Contains the session variable name to flash on screen.
- $string : string = ''
-
Contains the message to flash on the screen (optional).
Return values
mixed —Session variable if it exists, nothing if it is being set.
get()
Get a session variable.
public
static get(string $name) : mixed
Parameters
- $name : string
-
Contains the session variable name to retrieve.
Return values
mixed —Session variable.
put()
Create a new session variable.
public
static put(string $name, mixed $value) : void
TODO: specify mixed as $value type when minimum PHP version bumped to 8
Parameters
- $name : string
-
Contains the session variable name that will be created.
- $value : mixed
-
Contains the variable value to store