Fully Qualified Name: | Laminas\Session\SessionManager |
Extends: | AbstractManager |
Session ManagerInterface implementation utilizing ext/session
Name | Description | Defined By |
---|---|---|
__construct() | Constructor | SessionManager |
destroy() | Destroy/end a session | SessionManager |
expireSessionCookie() | Expire the session cookie | SessionManager |
forgetMe() | Set a 0s TTL for the session cookie | SessionManager |
getConfig() | Retrieve configuration object | AbstractManager |
getId() | Get session ID | SessionManager |
getName() | Get session name | SessionManager |
getSaveHandler() | Get SaveHandler Object | AbstractManager |
getStorage() | Retrieve storage object | AbstractManager |
getValidatorChain() | Get the validator chain to use when validating a session | SessionManager |
isValid() | Is this session valid? | SessionManager |
regenerateId() | Regenerate id | SessionManager |
rememberMe() | Set the TTL (in seconds) for the session cookie expiry | SessionManager |
sessionExists() | Does a session exist and is it currently active? | SessionManager |
setConfig() | Set configuration object | AbstractManager |
setId() | Set session ID | SessionManager |
setName() | Attempt to set the session name | SessionManager |
setSaveHandler() | Set session save handler object | AbstractManager |
setStorage() | Set session storage object | AbstractManager |
setValidatorChain() | Set the validator chain to use when validating a session | SessionManager |
start() | Start session | SessionManager |
writeClose() | Write session to save handler and close | SessionManager |
Constructor
Parameter Name | Type | Description |
---|---|---|
$config | \Config\ConfigInterface|null | |
$storage | \Storage\StorageInterface|null | |
$saveHandler | \SaveHandler\SaveHandlerInterface|null | |
$validators | array | |
$options | array |
Returns:
Destroy/end a session
Parameter Name | Type | Description |
---|---|---|
$options | array | See |
Returns: void
Expire the session cookie
Sends a session cookie with no value, and with an expiry in the past.
Returns: void
Set a 0s TTL for the session cookie
Can safely be called in the middle of a session.
Returns: \SessionManager
Retrieve configuration object
Returns: \Config
Get session ID
Proxies to {@link session_id()}
Returns: string
Get session name
Proxies to {@link session_name()}.
Returns: string
Get SaveHandler Object
Returns: \SaveHandler
Retrieve storage object
Returns: \Storage
Get the validator chain to use when validating a session
By default, uses an instance of {@link ValidatorChain}.
Returns: \EventManagerInterface
Is this session valid?
Notifies the Validator Chain until either all validators have returned true or one has failed.
Returns: bool
Regenerate id
Regenerate the session ID, using session save handler's native ID generation Can safely be called in the middle of a session.
Parameter Name | Type | Description |
---|---|---|
$deleteOldSession | bool |
Returns: \SessionManager
Set the TTL (in seconds) for the session cookie expiry
Can safely be called in the middle of a session.
Parameter Name | Type | Description |
---|---|---|
$ttl | null|int |
Returns: \SessionManager
Does a session exist and is it currently active?
Returns: bool
Set configuration object
Parameter Name | Type | Description |
---|---|---|
$config | \Config |
Returns: \AbstractManager
Set session ID
Can safely be called in the middle of a session.
Parameter Name | Type | Description |
---|---|---|
$id | string |
Returns: \SessionManager
Attempt to set the session name
If the session has already been started, or if the name provided fails validation, an exception will be raised.
Parameter Name | Type | Description |
---|---|---|
$name | string |
Returns: \SessionManager
Set session save handler object
Parameter Name | Type | Description |
---|---|---|
$saveHandler | \SaveHandler |
Returns: \AbstractManager
Set session storage object
Parameter Name | Type | Description |
---|---|---|
$storage | \Storage |
Returns: \AbstractManager
Set the validator chain to use when validating a session
In most cases, you should use an instance of {@link ValidatorChain}.
Parameter Name | Type | Description |
---|---|---|
$chain | \EventManagerInterface |
Returns: \SessionManager
Start session
if No session currently exists, attempt to start it. Calls {@link isValid()} once session_start() is called, and raises an exception if validation fails.
Parameter Name | Type | Description |
---|---|---|
$preserveStorage | bool | If |
Returns: void
Write session to save handler and close
Once done, the Storage object will be marked as isImmutable.
Returns: void