Session ManagerInterface implementation utilizing ext/session

Defines common constructor logic and getters for Storage and Configuration

package Default
inherited_from \Zend\Session\AbstractManager

 Methods

Constructor

__construct(\Zend\Session\Config\ConfigInterface|null $config = null, \Zend\Session\Storage\StorageInterface|null $storage = null, \Zend\Session\SaveHandler\SaveHandlerInterface|null $saveHandler = null, array $validators = array()
inherited_from \Zend\Session\AbstractManager::__construct()

Parameters

$config

\Zend\Session\Config\ConfigInterfacenull

$storage

\Zend\Session\Storage\StorageInterfacenull

$saveHandler

\Zend\Session\SaveHandler\SaveHandlerInterfacenull

$validators

array

Exceptions

\Zend\Session\Exception\RuntimeException

Constructor

__construct(\Zend\Session\Config\ConfigInterface|null $config = null, \Zend\Session\Storage\StorageInterface|null $storage = null, \Zend\Session\SaveHandler\SaveHandlerInterface|null $saveHandler = null, array $validators = array()
Inherited

Parameters

$config

\Zend\Session\Config\ConfigInterfacenull

$storage

\Zend\Session\Storage\StorageInterfacenull

$saveHandler

\Zend\Session\SaveHandler\SaveHandlerInterfacenull

$validators

array

Exceptions

\Zend\Session\Exception\RuntimeException

Destroy/end a session

destroy(array $options = null) : 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

\Zend\Session\SessionManager

Retrieve configuration object

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

Returns

\Zend\Session\Config\ConfigInterface

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\ManagerInterface::getSaveHandler()

Returns

\Zend\Session\SaveHandler\SaveHandlerInterface

Retrieve storage object

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

Returns

\Zend\Session\Storage\StorageInterface

Get the validator chain to use when validating a session

getValidatorChain() : \Zend\EventManager\EventManagerInterface

By default, uses an instance of \ValidatorChain.

Returns

\Zend\EventManager\EventManagerInterface

Is this session valid?

isValid() : boolean

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

Returns

boolean

Regenerate id

regenerateId(boolean $deleteOldSession = true) : \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

boolean

Returns

\Zend\Session\SessionManager

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

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

Can safely be called in the middle of a session.

Parameters

$ttl

nullinteger

Returns

\Zend\Session\SessionManager

Does a session exist and is it currently active?

sessionExists() : boolean

Returns

boolean

Set configuration object

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

Parameters

$config

\Zend\Session\Config\ConfigInterface

Returns

\Zend\Session\AbstractManager

Set session ID

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

Can safely be called in the middle of a session.

Parameters

$id

string

Returns

\Zend\Session\SessionManager

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

\Zend\Session\SessionManager

Set session save handler object

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

Parameters

$saveHandler

\Zend\Session\SaveHandler\SaveHandlerInterface

Returns

\Zend\Session\AbstractManager

Set session storage object

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

Parameters

$storage

\Zend\Session\Storage\StorageInterface

Returns

\Zend\Session\AbstractManager

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

$chain

\Zend\EventManager\EventManagerInterface

Returns

\Zend\Session\SessionManager

Start session

start(boolean $preserveStorage = false) : 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

boolean

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.

Create validators, insert reference value and add them to the validator chain

initializeValidatorChain() 

Register Save Handler with ext/session

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

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

Parameters

$saveHandler

\Zend\Session\SaveHandler\SaveHandlerInterface

Returns

boolean

Set the session cookie lifetime

setSessionCookieLifetime(integer $ttl) : void

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

Parameters

$ttl

integer

 Properties

 

$config

$config : \Zend\Session\Config\ConfigInterface

Default

 

Default configuration class to use when no configuration provided

$defaultConfigClass : string

Default

'Zend\Session\Config\SessionConfig'
 

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

array('send_expire_cookie' => true, 'clear_storage' => false)
 

Default storage class to use when no storage provided

$defaultStorageClass : string

Default

'Zend\Session\Storage\SessionArrayStorage'
 

value returned by session_name()

$name : string

Default

 

$saveHandler

$saveHandler : \Zend\Session\SaveHandler\SaveHandlerInterface

Default

 

$storage

$storage : \Zend\Session\Storage\StorageInterface

Default

 

Validation chain to determine if session is valid

$validatorChain : \Zend\EventManager\EventManagerInterface

Default

 

$validators

$validators : array

Default