Session
Extends \Joomla\Session\SessionClass for managing HTTP sessions
since |
1.5 |
---|---|
package |
Joomla CMS |
Methods
__construct
Constructor
__construct(\Joomla\Session\StorageInterface store = null, \Joomla\Event\DispatcherInterface dispatcher = null, array options = []) : mixed
since |
1.0 |
---|
Arguments
- store
\Joomla\Session\StorageInterface
A StorageInterface implementation.- dispatcher
\Joomla\Event\DispatcherInterface
DispatcherInterface for the session to use.- options
array
Optional parameters. Supported keys include:- name: The session name
- id: The session ID
- expire: The session lifetime in seconds
Response
mixed
checkToken
Checks for a form token in the request.
checkToken(string method = 'post') : bool
Use in conjunction with HTMLHelper::_('form.token') or JSession::getFormToken.
since |
2.5.4 |
---|
Arguments
- method
string
The request method in which to look for the token key.
Response
bool
True if found and valid, false otherwise.
clear
Clears all variables from the session store
clear() : void
since |
1.5 |
---|
get
Get data from the session store
get(string name, mixed default = null) : mixed
since |
1.5 |
---|
Arguments
- name
string
Name of a variable- default
mixed
Default value of a variable if not set
Response
mixed
Value of a variable
getFormToken
Method to determine a hash for anti-spoofing variable names
getFormToken(bool forceNew = false) : string
since |
1.6 |
---|
Arguments
- forceNew
bool
If true, force a new token to be created
Response
string
Hashed var name
getHandlers
Get the available session handlers
getHandlers() : array
since |
4.0.0 |
---|
Response
array
An array of available session handlers
getInstance
Returns the global session object.
getInstance() : static
since |
1.5 |
---|---|
deprecated |
5.0 Load the session service from the dependency injection container or via $app->getSession() |
Response
static
The Session object.
has
Check whether data exists in the session store
has(string name) : bool
since |
1.5 |
---|
Arguments
- name
string
Name of variable
Response
bool
True if the variable exists
set
Set data into the session store.
set(string name, mixed value = null) : mixed
since |
1.5 |
---|
Arguments
- name
string
Name of a variable.- value
mixed
Value of a variable.
Response
mixed
Old value of a variable.