Session ManagerInterface implementation utilizing ext/session

Defines common constructor logic and getters for Storage and Configuration

 Methods

Constructor

__construct(\Zend\Session\Config\ConfigInterface $config, \Zend\Session\Storage\StorageInterface $storage, \Zend\Session\SaveHandler\SaveHandlerInterface $saveHandler) 

Destroy/end a session

destroy(array $options) : void

Parameters

$options

array

See {@link $defaultDestroyOptions}

Expire the session cookie

expireSessionCookie() : void

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

Set a 0s TTL for the session cookie

forgetMe() : \Zend\Session\SessionManager

Can safely be called in the middle of a session.

Returns

Retrieve configuration object

getConfig() : \Zend\Session\Config\ConfigInterface
Inherited

inherited_from \Zend\Session\AbstractManager::getConfig()

Returns

Get session ID

getId() : string

Proxies to session_id()

Returns

string

Get session name

getName() : string

Proxies to session_name().

Returns

string

Get SaveHandler Object

getSaveHandler() : \Zend\Session\SaveHandler\SaveHandlerInterface
Inherited

inherited_from \Zend\Session\AbstractManager::getSaveHandler()

Returns

Retrieve storage object

getStorage() : \Zend\Session\Storage\StorageInterface
Inherited

inherited_from \Zend\Session\AbstractManager::getStorage()

Returns

Get the validator chain to use when validating a session

getValidatorChain() : \Zend\EventManager\EventManagerInterface

By default, uses an instance of ValidatorChain.

Returns

Is this session valid?

isValid() : bool

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

Returns

bool

Regenerate id

regenerateId(bool $deleteOldSession) : \Zend\Session\SessionManager

Regenerate the session ID, using session save handler's native ID generation Can safely be called in the middle of a session.

Parameters

$deleteOldSession

bool

Returns

Set the TTL (in seconds) for the session cookie expiry

rememberMe(null | int $ttl) : \Zend\Session\SessionManager

Can safely be called in the middle of a session.

Parameters

$ttl

nullint

Returns

Does a session exist and is it currently active?

sessionExists() : bool

Returns

bool

Set configuration object

setConfig(\Zend\Session\Config\ConfigInterface $config) : \Zend\Session\AbstractManager
Inherited

inherited_from \Zend\Session\AbstractManager::setConfig()

Parameters

Returns

Set session ID

setId(string $id) : \Zend\Session\SessionManager

Can safely be called in the middle of a session.

Parameters

$id

string

Returns

Attempt to set the session name

setName(string $name) : \Zend\Session\SessionManager

If the session has already been started, or if the name provided fails validation, an exception will be raised.

Parameters

$name

string

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

Set session save handler object

setSaveHandler(\Zend\Session\SaveHandler\SaveHandlerInterface $saveHandler) : \Zend\Session\AbstractManager
Inherited

inherited_from \Zend\Session\AbstractManager::setSaveHandler()

Parameters

Returns

Set session storage object

setStorage(\Zend\Session\Storage\StorageInterface $storage) : \Zend\Session\AbstractManager
Inherited

inherited_from \Zend\Session\AbstractManager::setStorage()

Parameters

Returns

Set the validator chain to use when validating a session

setValidatorChain(\Zend\EventManager\EventManagerInterface $chain) : \Zend\Session\SessionManager

In most cases, you should use an instance of ValidatorChain.

Parameters

Returns

Start session

start(bool $preserveStorage) : void

if No session currently exists, attempt to start it. Calls isValid() once session_start() is called, and raises an exception if validation fails.

Parameters

$preserveStorage

bool

If set to true, current session storage will not be overwritten by the contents of $_SESSION.

Exceptions

\Zend\Session\Exception\RuntimeException

Write session to save handler and close

writeClose() : void

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

Register Save Handler with ext/session

registerSaveHandler(\Zend\Session\SaveHandler\SaveHandlerInterface $saveHandler) : bool

Since ext/session is coupled to this particular session manager register the save handler with ext/session.

Parameters

Returns

bool

Set the session cookie lifetime

setSessionCookieLifetime(int $ttl) : void

If a session already exists, destroys it (without sending an expiration cookie), regenerates the session ID, and restarts the session.

Parameters

$ttl

int

 Properties

 

$config

$config : \Zend\Session\Config\ConfigInterface
Inherited

inherited_from \Zend\Session\AbstractManager::$$config
 

Default configuration class to use when no configuration provided

$defaultConfigClass : string
Inherited

inherited_from \Zend\Session\AbstractManager::$$defaultConfigClass
 

Default options when a call to {@link destroy()} is made - send_expire_cookie: whether or not to send a cookie expiring the current session cookie - clear_storage: whether or not to empty the storage object of any stored values

$defaultDestroyOptions : array

 

Default storage class to use when no storage provided

$defaultStorageClass : string
Inherited

inherited_from \Zend\Session\AbstractManager::$$defaultStorageClass
 

<p>value returned by session_name()</p>

$name : string

 

$saveHandler

$saveHandler : \Zend\Session\SaveHandler\SaveHandlerInterface
Inherited

inherited_from \Zend\Session\AbstractManager::$$saveHandler
 

$storage

$storage : \Zend\Session\Storage\StorageInterface
Inherited

inherited_from \Zend\Session\AbstractManager::$$storage
 

<p>Validation chain to determine if session is valid</p>

$validatorChain : \Zend\EventManager\EventManagerInterface