Class SessionManager

Summary

Fully Qualified Name: Zend\Session\SessionManager
Extends: AbstractManager

Description

Session ManagerInterface implementation utilizing ext/session

Methods

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

Method Details

__construct()

Constructor

Parameter Name Type Description
$config \Config\ConfigInterface|null
$storage \Storage\StorageInterface|null
$saveHandler \SaveHandler\SaveHandlerInterface|null
$validators array
$options array

Returns:

destroy()

Destroy/end a session

Parameter Name Type Description
$options array See

Returns: void

expireSessionCookie()

Expire the session cookie

Sends a session cookie with no value, and with an expiry in the past.

Returns: void

forgetMe()

Set a 0s TTL for the session cookie

Can safely be called in the middle of a session.

Returns: \SessionManager

getConfig()

Retrieve configuration object

Returns: \Config

getId()

Get session ID

Proxies to {@link session_id()}

Returns: string

getName()

Get session name

Proxies to {@link session_name()}.

Returns: string

getSaveHandler()

Get SaveHandler Object

Returns: \SaveHandler

getStorage()

Retrieve storage object

Returns: \Storage

getValidatorChain()

Get the validator chain to use when validating a session

By default, uses an instance of {@link ValidatorChain}.

Returns: \EventManagerInterface

isValid()

Is this session valid?

Notifies the Validator Chain until either all validators have returned true or one has failed.

Returns: bool

regenerateId()

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

rememberMe()

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

sessionExists()

Does a session exist and is it currently active?

Returns: bool

setConfig()

Set configuration object

Parameter Name Type Description
$config \Config

Returns: \AbstractManager

setId()

Set session ID

Can safely be called in the middle of a session.

Parameter Name Type Description
$id string

Returns: \SessionManager

setName()

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

setSaveHandler()

Set session save handler object

Parameter Name Type Description
$saveHandler \SaveHandler

Returns: \AbstractManager

setStorage()

Set session storage object

Parameter Name Type Description
$storage \Storage

Returns: \AbstractManager

setValidatorChain()

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()

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

writeClose()

Write session to save handler and close

Once done, the Storage object will be marked as isImmutable.

Returns: void

Top