Session
extends AbstractSession
in package
Session class
Tags
Table of Contents
Properties
- $instance : object|null
- Instance of the session
- $sessionId : string|null
- Session ID
- $sessionName : string|null
- Session Name
Methods
- __get() : mixed
- Get method to return the value of the $_SESSION global variable
- __isset() : bool
- Return the isset value of the $_SESSION global variable
- __set() : void
- Set a property in the session object that is linked to the $_SESSION global variable
- __unset() : void
- Unset the $_SESSION global variable
- count() : int
- Method to get the count of data in the session
- getId() : string
- Return the current the session id
- getInstance() : Session
- Determine whether or not an instance of the session object exists already, and instantiate the object if it does not exist.
- getIterator() : ArrayIterator
- Method to iterate over the session
- getName() : string
- Return the current the session name
- kill() : void
- Destroy the session
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- regenerateId() : void
- Regenerate the session id
- setRequestValue() : Session
- Set a request-based value
- setTimedValue() : Session
- Set a time-based value
- toArray() : array<string|int, mixed>
- Get the session values as an array
- __construct() : mixed
- Constructor
- checkExpiration() : void
- Check the time-based session value
- checkExpirations() : void
- Check the time-based session values
- checkRequest() : void
- Check the request-based session value
- checkRequests() : void
- Check the request-based session values
- init() : void
- Init the session
Properties
$instance
Instance of the session
private
static object|null
$instance
= null
$sessionId
Session ID
private
string|null
$sessionId
= null
$sessionName
Session Name
private
string|null
$sessionName
= null
Methods
__get()
Get method to return the value of the $_SESSION global variable
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Return the isset value of the $_SESSION global variable
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Set a property in the session object that is linked to the $_SESSION global variable
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
__unset()
Unset the $_SESSION global variable
public
__unset(string $name) : void
Parameters
- $name : string
Tags
count()
Method to get the count of data in the session
public
count() : int
Return values
intgetId()
Return the current the session id
public
getId() : string
Return values
stringgetInstance()
Determine whether or not an instance of the session object exists already, and instantiate the object if it does not exist.
public
static getInstance([array<string|int, mixed> $options = [] ]) : Session
Parameters
- $options : array<string|int, mixed> = []
Return values
SessiongetIterator()
Method to iterate over the session
public
getIterator() : ArrayIterator
Return values
ArrayIteratorgetName()
Return the current the session name
public
getName() : string
Return values
stringkill()
Destroy the session
public
kill() : void
offsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
regenerateId()
Regenerate the session id
public
regenerateId([bool $deleteOldSession = true ]) : void
Parameters
- $deleteOldSession : bool = true
setRequestValue()
Set a request-based value
public
setRequestValue(string $key, mixed $value[, int $hops = 1 ]) : Session
Parameters
- $key : string
- $value : mixed
- $hops : int = 1
Return values
SessionsetTimedValue()
Set a time-based value
public
setTimedValue(string $key, mixed $value[, int $expire = 300 ]) : Session
Parameters
- $key : string
- $value : mixed
- $expire : int = 300
Return values
SessiontoArray()
Get the session values as an array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>__construct()
Constructor
private
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
-
Private method to instantiate the session object
checkExpiration()
Check the time-based session value
private
checkExpiration(mixed $key) : void
Parameters
- $key : mixed
checkExpirations()
Check the time-based session values
private
checkExpirations() : void
checkRequest()
Check the request-based session value
private
checkRequest(mixed $key) : void
Parameters
- $key : mixed
checkRequests()
Check the request-based session values
private
checkRequests() : void
init()
Init the session
private
init() : void