Skip to content

NativeSession

Constants

Constant Visibility Type Value
SESSION_OPTIONS protected ['use_cookies' => 1, 'cookie_secure' => 1, 'cookie_lifetime' => 360, 'cookie_path' => '/', 'cookie_domain' => '', 'use_only_cookies' => 1, 'cookie_httponly' => 1, 'use_strict_mode' => 1, 'cache_limiter' => 'nocache', 'cache_expire' => 180, 'cookie_samesite' => 'Lax']

Properties

started

protected bool $started

config

protected \Qubus\Config\ConfigContainer $config

sessionId

protected ?string $sessionId

Methods

__construct

public __construct(\Qubus\Config\ConfigContainer $config, ?\SessionHandlerInterface $handler = null, ?string $sessionId = null): mixed

Parameters:

Parameter Type Description
$config \Qubus\Config\ConfigContainer
$handler ?\SessionHandlerInterface
$sessionId ?string

has

Checks if session exists.

public has(string $name): bool

Parameters:

Parameter Type Description
$name string Session name.

Throws:


get

Retrieve session.

public get(string $name): string|array

Parameters:

Parameter Type Description
$name string Session name.

Throws:


set

Sets the session.

public set(string $name, mixed $value): void

Parameters:

Parameter Type Description
$name string Session name.
$value mixed Value of the session set.

Throws:


configOptions

Returns an array of session configOptions.

public configOptions(): array

Throws:


isSessionActive

Returns true if sessions are enabled, and one exists.

public isSessionActive(): bool

sessionId

Returns the current session id if it exists. If not, it will be set.

public sessionId(string|null $id = null): string|null

Parameters:

Parameter Type Description
$id string|null Id of the session.

regenerateId

Updates the current session ID with a new one.

public regenerateId(): void

Throws:


startSession

Starts a new session or resumes an existing session.

public startSession(): void

Throws:


currentSessionName

Returns the current session name.

public currentSessionName(): string

destroySession

Destroys all session data.

public destroySession(): void

unsetSession

Destroy specific session data by key.

public unsetSession(string $key): void

Parameters:

Parameter Type Description
$key string

Throws:


getAll

Returns all session data.

public getAll(): array

Throws:


clear

public clear(): void

Throws:


getCookieParameters

Returns the session cookie parameters.

public getCookieParameters(): array


Automatically generated on 2025-10-13