SessionInterface
Extends IteratorAggregateInterface defining a Joomla! Session object
| since |
2.0.0 |
|---|---|
| package |
Joomla Framework |
Methods
abort
Aborts the current session
abort() :
| see | session_abort() |
|---|---|
| since |
2.0.0 |
Response
bool
all
Retrieves all variables from the session store
all() : mixed||string|int
| since |
2.0.0 |
|---|
Response
array<string|int, mixed>
clear
Clears all variables from the session store
clear() :
| since |
2.0.0 |
|---|
Response
void
close
Writes session data and ends session
close() :
Session data is usually stored after your script terminated without the need to call SessionInterface::close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
| see | session_write_close() |
|---|---|
| since |
2.0.0 |
Response
void
destroy
Frees all session variables and destroys all data registered to a session
destroy() :
This method resets the $_SESSION variable and destroys all of the data associated with the current session in its storage (file or DB). It forces new session to be started after this method is called. It does not unset the session cookie.
| see | session_destroy() session_unset() |
|---|---|
| since |
2.0.0 |
Response
bool
fork
Create a new session and copy variables from the old one
fork() :
| since |
2.0.0 |
|---|
Response
bool
gc
Perform session data garbage collection
gc() : int|bool
| see | session_gc() |
|---|---|
| since |
2.0.0 |
Response
int|boolNumber of deleted sessions on success or boolean false on failure or if the function is unsupported
get
Get data from the session store
get( name, default = null) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of a variable- default
mixedDefault value of a variable if not set
Response
mixedValue of a variable
getExpire
Get expiration time in seconds
getExpire() :
| since |
2.0.0 |
|---|
Response
intThe session expiration time in seconds
getId
Get the session ID
getId() :
| since |
2.0.0 |
|---|
Response
stringThe session ID
getName
Get the session name
getName() :
| since |
2.0.0 |
|---|
Response
stringThe session name
getToken
Get a session token.
getToken( forceNew = false) :
Tokens are used to secure forms from spamming attacks. Once a token has been generated the system will check the request to see if it is present, if not it will invalidate the session.
| since |
2.0.0 |
|---|
Arguments
- forceNew
boolIf true, forces a new token to be created
Response
string
has
Check whether data exists in the session store
has( name) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of variable
Response
boolTrue if the variable exists
hasToken
Check if the session has the given token.
hasToken( token, forceExpire = true) :
| since |
2.0.0 |
|---|
Arguments
- token
stringHashed token to be verified- forceExpire
boolIf true, expires the session
Response
bool
isActive
Check if the session is active
isActive() :
| since |
2.0.0 |
|---|
Response
bool
isNew
Check whether this session is newly created
isNew() :
| since |
2.0.0 |
|---|
Response
bool
isStarted
Check if the session is started
isStarted() :
| since |
2.0.0 |
|---|
Response
bool
remove
Unset a variable from the session store
remove( name) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of variable
Response
mixedThe value from session or NULL if not set
restart
Restart an expired or locked session
restart() :
| see | destroy |
|---|---|
| since |
2.0.0 |
Response
boolTrue on success
set
Set data into the session store
set( name, value = null) :
| since |
2.0.0 |
|---|
Arguments
- name
stringName of a variable.- value
mixedValue of a variable.
Response
mixedOld value of a variable.
setId
Set the session ID
setId( id) :
| since |
2.0.0 |
|---|
Arguments
- id
stringThe session ID
Response
$this
setName
Set the session name
setName( name) :
| since |
2.0.0 |
|---|
Arguments
- name
stringThe session name
Response
$this
start
Start a session
start() :
| since |
2.0.0 |
|---|
Response
void