final class NativeSessionStorage implements SessionStorageInterface (View source)

Adapts PHP's native session runtime with framework-configured cookie and garbage-collection policy.

The active PHP save handler owns persistence and timestamp renewal when the session is closed at traditional request shutdown; gc_maxlifetime supplies a GC threshold, not read-time expiration.

Methods

__construct(string $cookieName = 'LEMONADE_SESSION', int $lifetimeSeconds = 7200, string|null $savePath = null, SessionCookie|null $cookie = null, SessionGarbageCollectionPolicy|null $garbageCollectionPolicy = null)

Defines the native identity, sliding retention, save path, and request-driven GC probability.

void
start()

Starts or resumes the PHP session and refreshes both native storage and browser retention.

void
bool

Reports whether this cookie identity owns the active native PHP session.

bool
bool
has(string $key)

Checks the active native payload for a key.

bool
mixed
get(string $key, mixed $default = null)

Returns a native session value or the supplied fallback.

mixed
void
set(string $key, mixed $value)

Stores a value for persistence when PHP closes the active session.

void
void
remove(string $key)

Removes one value for persistence when PHP closes the active session.

void
void
clear()

Clears the payload while preserving the active identifier and cookie.

void
void

Deletes the native record and cookie so later access receives a fresh identity.

void
void
regenerate(bool $deleteOldSession = true)

Rotates the native identifier, preserves its payload, and optionally deletes the old record.

void

Details

__construct

__construct(string $cookieName = 'LEMONADE_SESSION', int $lifetimeSeconds = 7200, string|null $savePath = null, SessionCookie|null $cookie = null, SessionGarbageCollectionPolicy|null $garbageCollectionPolicy = null)

Defines the native identity, sliding retention, save path, and request-driven GC probability.

Parameters

string $cookieName
int $lifetimeSeconds
string|null $savePath
SessionCookie|null $cookie
SessionGarbageCollectionPolicy|null $garbageCollectionPolicy

start

void start()

Starts or resumes the PHP session and refreshes both native storage and browser retention.

Return Value

void

started

bool started()

Reports whether this cookie identity owns the active native PHP session.

Return Value

bool

has

bool has(string $key)

Checks the active native payload for a key.

Parameters

string $key

Return Value

bool

get

mixed get(string $key, mixed $default = null)

Returns a native session value or the supplied fallback.

Parameters

string $key
mixed $default

Return Value

mixed

set

void set(string $key, mixed $value)

Stores a value for persistence when PHP closes the active session.

Parameters

string $key
mixed $value

Return Value

void

remove

void remove(string $key)

Removes one value for persistence when PHP closes the active session.

Parameters

string $key

Return Value

void

clear

void clear()

Clears the payload while preserving the active identifier and cookie.

Return Value

void

destroy

void destroy()

Deletes the native record and cookie so later access receives a fresh identity.

Return Value

void

regenerate

void regenerate(bool $deleteOldSession = true)

Rotates the native identifier, preserves its payload, and optionally deletes the old record.

Parameters

bool $deleteOldSession

Return Value

void