Documentation

DatabaseSessionHandler
in package
implements SessionHandlerInterface, ExistenceAwareInterface Uses InteractsWithTime

Interfaces, Classes and Traits

SessionHandlerInterface
ExistenceAwareInterface

Table of Contents

$connection  : ConnectionInterface
The database connection instance.
$container  : Container
The container instance.
$exists  : bool
The existence state of the session.
$minutes  : int
The number of minutes the session should be valid.
$table  : string
The name of the session table.
__construct()  : void
Create a new database session handler instance.
close()  : mixed
{@inheritdoc}
destroy()  : mixed
{@inheritdoc}
gc()  : mixed
{@inheritdoc}
open()  : mixed
{@inheritdoc}
read()  : mixed
{@inheritdoc}
setExists()  : $this
Set the existence state for the session.
write()  : mixed
{@inheritdoc}
addRequestInformation()  : $this
Add the request information to the session payload.
addUserInformation()  : $this
Add the user information to the session payload.
availableAt()  : int
Get the "available at" UNIX timestamp.
currentTime()  : int
Get the current system time as a UNIX timestamp.
expired()  : bool
Determine if the session is expired.
getDefaultPayload()  : array<string|int, mixed>
Get the default payload for the session.
getQuery()  : Builder
Get a fresh query builder instance for the table.
ipAddress()  : string
Get the IP address for the current request.
parseDateInterval()  : DateTimeInterface|int
If the given value is an interval, convert it to a DateTime instance.
performInsert()  : bool|null
Perform an insert operation on the session ID.
performUpdate()  : int
Perform an update operation on the session ID.
secondsUntil()  : int
Get the number of seconds until the given DateTime.
userAgent()  : string
Get the user agent for the current request.
userId()  : mixed
Get the currently authenticated user's ID.

Properties

Methods

destroy()

{@inheritdoc}

public destroy(mixed $sessionId) : mixed
Parameters
$sessionId : mixed
Return values
mixed

gc()

{@inheritdoc}

public gc(mixed $lifetime) : mixed
Parameters
$lifetime : mixed
Return values
mixed

open()

{@inheritdoc}

public open(mixed $savePath, mixed $sessionName) : mixed
Parameters
$savePath : mixed
$sessionName : mixed
Return values
mixed

read()

{@inheritdoc}

public read(mixed $sessionId) : mixed
Parameters
$sessionId : mixed
Return values
mixed

setExists()

Set the existence state for the session.

public setExists(bool $value) : $this
Parameters
$value : bool
Return values
$this

write()

{@inheritdoc}

public write(mixed $sessionId, mixed $data) : mixed
Parameters
$sessionId : mixed
$data : mixed
Return values
mixed

addRequestInformation()

Add the request information to the session payload.

protected addRequestInformation(array<string|int, mixed> &$payload) : $this
Parameters
$payload : array<string|int, mixed>
Return values
$this

addUserInformation()

Add the user information to the session payload.

protected addUserInformation(array<string|int, mixed> &$payload) : $this
Parameters
$payload : array<string|int, mixed>
Return values
$this

availableAt()

Get the "available at" UNIX timestamp.

protected availableAt(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

currentTime()

Get the current system time as a UNIX timestamp.

protected currentTime() : int
Return values
int

expired()

Determine if the session is expired.

protected expired(stdClass $session) : bool
Parameters
$session : stdClass
Return values
bool

getDefaultPayload()

Get the default payload for the session.

protected getDefaultPayload(string $data) : array<string|int, mixed>
Parameters
$data : string
Return values
array<string|int, mixed>

ipAddress()

Get the IP address for the current request.

protected ipAddress() : string
Return values
string

parseDateInterval()

If the given value is an interval, convert it to a DateTime instance.

protected parseDateInterval(DateTimeInterface|DateInterval|int $delay) : DateTimeInterface|int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
DateTimeInterface|int

performInsert()

Perform an insert operation on the session ID.

protected performInsert(string $sessionId, string $payload) : bool|null
Parameters
$sessionId : string
$payload : string
Return values
bool|null

performUpdate()

Perform an update operation on the session ID.

protected performUpdate(string $sessionId, string $payload) : int
Parameters
$sessionId : string
$payload : string
Return values
int

secondsUntil()

Get the number of seconds until the given DateTime.

protected secondsUntil(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

userAgent()

Get the user agent for the current request.

protected userAgent() : string
Return values
string

userId()

Get the currently authenticated user's ID.

protected userId() : mixed
Return values
mixed

Search results