Session ManagerInterface implementation utilizing ext/session.
More...
|
| __construct (Config\ConfigInterface $config=null, Storage\StorageInterface $storage=null, SaveHandler\SaveHandlerInterface $saveHandler=null, array $validators=[], array $options=[]) |
| Constructor.
|
|
| sessionExists () |
| Does a session exist and is it currently active?
|
|
| start ($preserveStorage=false) |
| Start session.
|
|
| destroy (array $options=null) |
| Destroy/end a session.
|
|
| writeClose () |
| Write session to save handler and close.
|
|
| setName ($name) |
| Attempt to set the session name.
|
|
| getName () |
| Get session name.
|
|
| setId ($id) |
| Set session ID.
|
|
| getId () |
| Get session ID.
|
|
| regenerateId ($deleteOldSession=true) |
| Regenerate id.
|
|
| rememberMe ($ttl=null) |
| Set the TTL (in seconds) for the session cookie expiry.
|
|
| forgetMe () |
| Set a 0s TTL for the session cookie.
|
|
| setValidatorChain (EventManagerInterface $chain) |
| Set the validator chain to use when validating a session.
|
|
| getValidatorChain () |
| Get the validator chain to use when validating a session.
|
|
| isValid () |
| Is this session valid?
|
|
| expireSessionCookie () |
| Expire the session cookie.
|
|
| __construct (Config $config=null, Storage $storage=null, SaveHandler $saveHandler=null, array $validators=[]) |
| Constructor.
|
|
| setConfig (Config $config) |
| Set configuration object.
|
|
| getConfig () |
| Retrieve configuration object.
|
|
| setStorage (Storage $storage) |
| Set session storage object.
|
|
| getStorage () |
| Retrieve storage object.
|
|
| setSaveHandler (SaveHandler $saveHandler) |
| Set session save handler object.
|
|
| getSaveHandler () |
| Get SaveHandler Object.
|
|
Session ManagerInterface implementation utilizing ext/session.
__construct |
( |
Config\ConfigInterface |
$config = null , |
|
|
Storage\StorageInterface |
$storage = null , |
|
|
SaveHandler\SaveHandlerInterface |
$saveHandler = null , |
|
|
array |
$validators = [] , |
|
|
array |
$options = [] |
|
) |
| |
Constructor.
- Parameters
-
Config\ConfigInterface | null | $config | |
Storage\StorageInterface | null | $storage | |
SaveHandler\SaveHandlerInterface | null | $saveHandler | |
array | $validators | |
array | $options | |
- Exceptions
-
Exception\RuntimeException | |
destroy |
( |
array |
$options = null | ) |
|
Destroy/end a session.
- Parameters
-
- 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
Get the validator chain to use when validating a session.
By default, uses an instance of ValidatorChain.
- Returns
- EventManagerInterface
initializeValidatorChain |
( |
| ) |
|
|
protected |
Create validators, insert reference value and add them to the validator chain.
Is this session valid?
Notifies the Validator Chain until either all validators have returned true or one has failed.
- Returns
- bool
regenerateId |
( |
|
$deleteOldSession = true | ) |
|
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
-
- Returns
- SessionManager
registerSaveHandler |
( |
SaveHandler\SaveHandlerInterface |
$saveHandler | ) |
|
|
protected |
Register Save Handler with ext/session.
Since ext/session is coupled to this particular session manager register the save handler with ext/session.
- Parameters
-
SaveHandler\SaveHandlerInterface | $saveHandler | |
- Returns
- bool
rememberMe |
( |
|
$ttl = null | ) |
|
Set the TTL (in seconds) for the session cookie expiry.
Can safely be called in the middle of a session.
- Parameters
-
- Returns
- SessionManager
Does a session exist and is it currently active?
- Returns
- bool
Set session ID.
Can safely be called in the middle of a session.
- Parameters
-
- 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.
- Parameters
-
- Returns
- SessionManager
- Exceptions
-
Exception\InvalidArgumentException | |
setSessionCookieLifetime |
( |
|
$ttl | ) |
|
|
protected |
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
-
- Returns
- void
Set the validator chain to use when validating a session.
In most cases, you should use an instance of ValidatorChain.
- Parameters
-
EventManagerInterface | $chain | |
- Returns
- SessionManager
start |
( |
|
$preserveStorage = false | ) |
|
Start session.
if No session currently exists, attempt to start it. Calls isValid() once session_start() is called, and raises an exception if validation fails.
- Parameters
-
bool | $preserveStorage | If set to true, current session storage will not be overwritten by the contents of $_SESSION. |
- Returns
- void
- Exceptions
-
Exception\RuntimeException | |
Write session to save handler and close.
Once done, the Storage object will be marked as isImmutable.
- Returns
- void
Initial value:= [
'send_expire_cookie' => true
Initial value:= [
'attach_default_validators' => true
Initial value:= [
Validator\Id::class,
]