Documentation

SessionInterface extends IteratorAggregate

Class Session

Tags
extends

Table of Contents

Methods

__get()  : mixed
Returns session variable.
__isset()  : bool
Checks if session variable is defined.
__set()  : void
Sets session variable.
__unset()  : void
Removes session variable.
clear()  : $this
Free all session variables.
close()  : $this
Force the session to be saved and closed
getAll()  : array<string|int, mixed>
Returns all session variables.
getId()  : string|null
Get session ID
getInstance()  : Session
Get current session instance.
getIterator()  : ArrayIterator
Retrieve an external iterator
getName()  : string|null
Get session name
invalidate()  : $this
Invalidates the current session.
isStarted()  : bool
Checks if the session was started.
setId()  : $this
Set session ID
setName()  : $this
Set session name
setOptions()  : void
Sets session.* ini variables.
start()  : $this
Starts the session storage

Methods

__get()

Returns session variable.

public __get(string $name) : mixed
Parameters
$name : string
Attributes
#[ReturnTypeWillChange]

__isset()

Checks if session variable is defined.

public __isset(string $name) : bool
Parameters
$name : string
Attributes
#[ReturnTypeWillChange]
Return values
bool

__set()

Sets session variable.

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed
Attributes
#[ReturnTypeWillChange]

__unset()

Removes session variable.

public __unset(string $name) : void
Parameters
$name : string
Attributes
#[ReturnTypeWillChange]

clear()

Free all session variables.

public clear() : $this
Return values
$this

close()

Force the session to be saved and closed

public close() : $this
Return values
$this

getAll()

Returns all session variables.

public getAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

getId()

Get session ID

public getId() : string|null
Return values
string|null

Session ID

getIterator()

Retrieve an external iterator

public getIterator() : ArrayIterator
Tags
phpstan-return

ArrayIterator<array-key,mixed>

Attributes
#[ReturnTypeWillChange]
Return values
ArrayIterator

Return an ArrayIterator of $_SESSION

getName()

Get session name

public getName() : string|null
Return values
string|null

invalidate()

Invalidates the current session.

public invalidate() : $this
Return values
$this

isStarted()

Checks if the session was started.

public isStarted() : bool
Return values
bool

setId()

Set session ID

public setId(string $id) : $this
Parameters
$id : string

Session ID

Return values
$this

setName()

Set session name

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

start()

Starts the session storage

public start([bool $readonly = false ]) : $this
Parameters
$readonly : bool = false
Tags
throws
RuntimeException
Return values
$this

        
On this page

Search results