DatabaseSessionHandler
Implements
Uses
Properties
$table string
The name of the session table.
$minutes int
The number of minutes the session should be valid.
$exists bool
The existence state of the session.
Methods
__construct ( ConnectionInterface $connection , $table , $minutes , Container $container ) : void
Create a new database session handler instance.
Parameters
- $connection ConnectionInterface
- $table string
- $minutes int
- $container Container |null
open ( $savePath , $sessionName ) : bool
{@inheritdoc}
close ( ) : bool
{@inheritdoc}
read ( $sessionId ) : string|false
{@inheritdoc}
expired ( $session ) : bool
Determine if the session is expired.
Parameters
- $session stdClass
write ( $sessionId , $data ) : bool
{@inheritdoc}
performInsert ( $sessionId , $payload ) : bool|null
Perform an insert operation on the session ID.
Parameters
- $sessionId string
-
$payload
array
performUpdate ( $sessionId , $payload ) : int
Perform an update operation on the session ID.
Parameters
- $sessionId string
-
$payload
array
getDefaultPayload ( $data ) : array
Get the default payload for the session.
Parameters
- $data string
addUserInformation ( $payload ) : $this
Add the user information to the session payload.
Parameters
- $payload array
userId ( ) : mixed
Get the currently authenticated user's ID.
addRequestInformation ( $payload ) : $this
Add the request information to the session payload.
Parameters
- $payload array
ipAddress ( ) : string
Get the IP address for the current request.
userAgent ( ) : string
Get the user agent for the current request.
destroy ( $sessionId ) : bool
{@inheritdoc}
gc ( $lifetime ) : int|false
{@inheritdoc}
setContainer ( $container ) : $this
Set the application instance used by the handler.
Parameters
- $container Application
setExists ( $value ) : $this
Set the existence state for the session.
Parameters
- $value bool