Session
class Session
Provides access to session sections as well as session settings and management methods.
Constants
private DefaultFileLifetime |
Default file lifetime |
private SecurityOptions |
|
Properties
$onStart | |||
$onBeforeWrite |
Methods
Starts and initializes session data.
No description
No description
Has been session started?
Ends the current session and store session data.
Destroys all data registered to a session.
Does session exist 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.
No description
Sets session options.
Returns all session options.
Sets the amount of time (like '20 minutes') allowed between requests before the session will be terminated, null means "for a maximum of 3 hours or until the browser is closed".
Sets the session cookie parameters.
Sets path of the directory used to save session data.
Details
at line 86
void
start()
Starts and initializes session data.
at line 142
void
autoStart(bool $forWrite)
internal |
No description
at line 198
__destruct()
No description
at line 207
bool
isStarted()
Has been session started?
at line 216
void
close()
Ends the current session and store session data.
at line 229
void
destroy()
Destroys all data registered to a session.
at line 249
bool
exists()
Does session exist for the current request?
at line 260
void
regenerateId()
Regenerates the session ID.
at line 283
string
getId()
Returns the current session ID. Don't make dependencies, can be changed for each request.
at line 293
Session
setName(string $name)
Sets the session name to a specified one.
at line 309
string
getName()
Gets the session name.
at line 322
SessionSection
getSection(string $section, string $class = SessionSection::class)
Returns specified session section.
at line 331
bool
hasSection(string $section)
Checks if a session section exist and is not empty.
at line 342
array
getSectionNames()
No description
at line 353
Iterator
getIterator()
deprecated
deprecated
No description
at line 389
Session
setOptions(array $options)
Sets session options.
at line 437
array
getOptions()
Returns all session options.
at line 504
Session
setExpiration(string|null $expire)
Sets the amount of time (like '20 minutes') allowed between requests before the session will be terminated, null means "for a maximum of 3 hours or until the browser is closed".
at line 526
Session
setCookieParameters(string $path, string|null $domain = null, bool|null $secure = null, string|null $sameSite = null)
Sets the session cookie parameters.
at line 542
array
getCookieParameters()
deprecated
deprecated
No description
at line 553
Session
setSavePath(string $path)
Sets path of the directory used to save session data.
at line 565
Session
setHandler(SessionHandlerInterface $handler)
Sets user session handler.