Session
class Session
Provides access to session sections as well as session settings and management methods.
Constants
DEFAULT_FILE_LIFETIME |
Default file lifetime |
Methods
Starts and initializes session data.
Has been session started?
Ends the current session and store session data.
Destroys all data registered to a session.
Does session exists for the current request?
Regenerates the session ID.
Returns the current session ID. Don't make dependencies, can be changed for each request.
Gets the session name.
Returns specified session section.
Checks if a session section exist and is not empty.
Iteration over all sections.
Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.
Sets session options.
Returns all session options.
Sets the amount of time allowed between requests before the session will be terminated.
Sets the session cookie parameters.
Returns the session cookie parameters.
Sets path of the directory used to save session data.
Details
at line 70
void
start()
Starts and initializes session data.
at line 148
bool
isStarted()
Has been session started?
at line 158
void
close()
Ends the current session and store session data.
at line 172
void
destroy()
Destroys all data registered to a session.
at line 192
bool
exists()
Does session exists for the current request?
at line 203
void
regenerateId()
Regenerates the session ID.
at line 225
string
getId()
Returns the current session ID. Don't make dependencies, can be changed for each request.
at line 236
Session
setName($name)
Sets the session name to a specified one.
at line 253
string
getName()
Gets the session name.
at line 269
SessionSection
getSection($section, $class = SessionSection::class)
Returns specified session section.
at line 280
bool
hasSection($section)
Checks if a session section exist and is not empty.
at line 294
Iterator
getIterator()
Iteration over all sections.
at line 314
void
clean()
internal |
Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.
at line 349
Session
setOptions(array $options)
Sets session options.
at line 374
array
getOptions()
Returns all session options.
at line 442
Session
setExpiration($time)
Sets the amount of time allowed between requests before the session will be terminated.
at line 468
Session
setCookieParameters($path, $domain = null, $secure = null, $samesite = null)
Sets the session cookie parameters.
at line 483
array
getCookieParameters()
Returns the session cookie parameters.
at line 493
Session
setSavePath($path)
Sets path of the directory used to save session data.
at line 505
Session
setStorage(ISessionStorage $storage)
deprecated
deprecated
No description
at line 522
Session
setHandler(SessionHandlerInterface $handler)
Sets user session handler.