1734. Class

1734.1. Zend\Session\SessionManager

Session ManagerInterface implementation utilizing ext/session

1734.1.1. Methods

1734.1.1.1. __construct

__construct()

Constructor

Parameters:
  • ConfigConfigInterface|null
  • StorageStorageInterface|null
  • SaveHandlerSaveHandlerInterface|null
Throws ExceptionRuntimeException:
 

1734.1.1.2. sessionExists

sessionExists()

Does a session exist and is it currently active?

Return type:bool

1734.1.1.3. start

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.

Parameters:bool – If set to true, current session storage will not be overwritten by the contents of $_SESSION.
Return type:void
Throws :ExceptionRuntimeException

1734.1.1.4. destroy

destroy()

Destroy/end a session

Parameters:array – See {@link $defaultDestroyOptions}
Return type:void

1734.1.1.5. writeClose

writeClose()

Write session to save handler and close

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

Return type:void

1734.1.1.6. setName

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.

Parameters:string
Return type:SessionManager
Throws :ExceptionInvalidArgumentException

1734.1.1.7. getName

getName()

Get session name

Proxies to {@link session_name()}.

Return type:string

1734.1.1.8. setId

setId()

Set session ID

Can safely be called in the middle of a session.

Parameters:string
Return type:SessionManager

1734.1.1.9. getId

getId()

Get session ID

Proxies to {@link session_id()}

Return type:string

1734.1.1.10. regenerateId

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.

Parameters:bool
Return type:SessionManager

1734.1.1.11. rememberMe

rememberMe()

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

Can safely be called in the middle of a session.

Parameters:null|int
Return type:SessionManager

1734.1.1.12. forgetMe

forgetMe()

Set a 0s TTL for the session cookie

Can safely be called in the middle of a session.

Return type:SessionManager

1734.1.1.13. setValidatorChain

setValidatorChain()

Set the validator chain to use when validating a session

In most cases, you should use an instance of {@link ValidatorChain}.

Parameters:EventManagerInterface
Return type:SessionManager

1734.1.1.14. getValidatorChain

getValidatorChain()

Get the validator chain to use when validating a session

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

Return type:EventManagerInterface

1734.1.1.15. isValid

isValid()

Is this session valid?

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

Return type:bool

1734.1.1.16. expireSessionCookie

expireSessionCookie()

Expire the session cookie

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

Return type:void

1734.1.1.17. setSessionCookieLifetime

setSessionCookieLifetime()

Set the session cookie lifetime

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

Parameters:int
Return type:void

1734.1.1.18. registerSaveHandler

registerSaveHandler()

Register Save Handler with ext/session

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

Parameters:SaveHandlerSaveHandlerInterface
Return type:bool