Session
class Session
Session class.
Constants
MAX_TOKENS |
Maximum number of tokens stored per session. |
Properties
protected bool | $destroyed | Has the session been destroyed? | |
protected Request | $request | Request. | |
protected Response | $response | Response. | |
protected StoreInterface | $store | Session store. | |
protected bool | $autoCommit | Should the session data be commited automatically? | |
protected array | $options | Session options. | |
protected string | $sessionId | Session id. | |
protected array | $sessionData | Session data. | |
protected array | $flashData | Flashdata. | |
protected string | $token | Session token. |
Methods
Constructor.
Destructor.
Starts the session.
Writes data to session store.
Calls the session store garbage collector.
Generates a session id.
Adds a session cookie to the response.
Loads the session data.
Returns the session id.
Regenerate the session id and returns it.
Returns all the seesion data.
Store a value in the session.
Returns TRUE if key exists in the session and FALSE if not.
Returns a value from the session.
Gets a value from the session and replaces it.
Gets a value from the session and removes it.
Removes a value from the session.
Store a flash value in the session.
Returns TRUE if key exists in the session and FALSE if not.
Returns a flash value from the session.
Removes a value from the session.
Extends the lifetime of the flash data by one request.
Returns the session token.
Generates a new session token and returns it.
Validates the provided token.
Returns random security token.
Validates security token.
Clears all session data.
Destroys the session.
Details
at line 129
__construct(Request $request, Response $response, StoreInterface $store, array $options = [], bool $autoCommit = true)
Constructor.
at line 149
__destruct()
Destructor.
at line 160
protected
start()
Starts the session.
at line 192
commit()
Writes data to session store.
at line 209
protected
gc()
Calls the session store garbage collector.
at line 222
protected string
generateId()
Generates a session id.
at line 230
protected
setCookie()
Adds a session cookie to the response.
at line 243
protected
loadData()
Loads the session data.
at line 253
string
getId()
Returns the session id.
at line 264
string
regenerateId(bool $keepOld = false)
Regenerate the session id and returns it.
at line 289
array
getData()
Returns all the seesion data.
at line 300
put(string $key, mixed $value)
Store a value in the session.
at line 311
bool
has(string $key)
Returns TRUE if key exists in the session and FALSE if not.
at line 323
mixed
get(string $key, mixed $default = null)
Returns a value from the session.
at line 336
mixed
getAndPut(string $key, mixed $value, mixed $default = null)
Gets a value from the session and replaces it.
at line 352
mixed
getAndRemove(string $key, mixed $default = null)
Gets a value from the session and removes it.
at line 366
remove(string $key)
Removes a value from the session.
at line 378
mixed
putFlash(string $key, mixed $value)
Store a flash value in the session.
at line 389
bool
hasFlash(string $key)
Returns TRUE if key exists in the session and FALSE if not.
at line 401
mixed
getFlash(string $key, mixed $default = null)
Returns a flash value from the session.
at line 411
removeFlash(string $key)
Removes a value from the session.
at line 421
reflash(array $keys = [])
Extends the lifetime of the flash data by one request.
at line 435
string
getToken()
Returns the session token.
at line 445
string
regenerateToken()
Generates a new session token and returns it.
at line 456
bool
validateToken(string $token)
Validates the provided token.
at line 466
string
generateOneTimeToken()
Returns random security token.
at line 490
bool
validateOneTimeToken(string $token)
Validates security token.
at line 511
clear()
Clears all session data.
at line 519
destroy()
Destroys the session.