NativeSessionStorage
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
Defines the native identity, sliding retention, save path, and request-driven GC probability.
Starts or resumes the PHP session and refreshes both native storage and browser retention.
Reports whether this cookie identity owns the active native PHP session.
Checks the active native payload for a key.
Returns a native session value or the supplied fallback.
Stores a value for persistence when PHP closes the active session.
Removes one value for persistence when PHP closes the active session.
Clears the payload while preserving the active identifier and cookie.
Deletes the native record and cookie so later access receives a fresh identity.
Rotates the native identifier, preserves its payload, and optionally deletes the old record.
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.
start
void
start()
Starts or resumes the PHP session and refreshes both native storage and browser retention.
started
bool
started()
Reports whether this cookie identity owns the active native PHP session.
has
bool
has(string $key)
Checks the active native payload for a key.
get
mixed
get(string $key, mixed $default = null)
Returns a native session value or the supplied fallback.
set
void
set(string $key, mixed $value)
Stores a value for persistence when PHP closes the active session.
remove
void
remove(string $key)
Removes one value for persistence when PHP closes the active session.
clear
void
clear()
Clears the payload while preserving the active identifier and cookie.
destroy
void
destroy()
Deletes the native record and cookie so later access receives a fresh identity.
regenerate
void
regenerate(bool $deleteOldSession = true)
Rotates the native identifier, preserves its payload, and optionally deletes the old record.