Neuron-PHP

SessionManager
in package

Session management utility.

Handles session initialization, regeneration, flash messages, and secure session configuration.

Table of Contents

Properties

$_config  : array<string, mixed>
$_started  : bool

Methods

__construct()  : mixed
destroy()  : bool
Destroy the session
flash()  : void
Set a flash message (available for next request only)
get()  : mixed
Get a session value
getAllFlash()  : array<string, mixed>
Get all flash messages and clear them
getFlash()  : mixed
Get a flash message
getId()  : string
Get session ID
has()  : bool
Check if session has a key
hasFlash()  : bool
Check if flash message exists
isStarted()  : bool
Check if session is started
regenerate()  : bool
Regenerate session ID (prevent session fixation)
remove()  : void
Remove a session value
set()  : void
Set a session value
start()  : void
Start the session with secure configuration

Properties

Methods

__construct()

public __construct([array<string, mixed> $config = [] ]) : mixed
Parameters
$config : array<string, mixed> = []

destroy()

Destroy the session

public destroy() : bool
Return values
bool

flash()

Set a flash message (available for next request only)

public flash(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

get()

Get a session value

public get(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

getAllFlash()

Get all flash messages and clear them

public getAllFlash() : array<string, mixed>
Return values
array<string, mixed>

getFlash()

Get a flash message

public getFlash(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

getId()

Get session ID

public getId() : string
Return values
string

has()

Check if session has a key

public has(string $key) : bool
Parameters
$key : string
Return values
bool

hasFlash()

Check if flash message exists

public hasFlash(string $key) : bool
Parameters
$key : string
Return values
bool

isStarted()

Check if session is started

public isStarted() : bool
Return values
bool

regenerate()

Regenerate session ID (prevent session fixation)

public regenerate([bool $deleteOldSession = true ]) : bool
Parameters
$deleteOldSession : bool = true
Return values
bool

remove()

Remove a session value

public remove(string $key) : void
Parameters
$key : string

set()

Set a session value

public set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

start()

Start the session with secure configuration

public start() : void

        
On this page

Search results