Session
extends Session
in package
Class Session
Table of Contents
Properties
- $autoStart : bool
- $instance : Session
- $options : array<string|int, mixed>
- $started : bool
Methods
- __construct() : mixed
- Session constructor.
- __get() : mixed
- Returns session variable.
- __isset() : bool
- Checks if session variable is defined.
- __set() : void
- Sets session variable.
- __unset() : void
- Removes session variable.
- all() : array<string|int, mixed>
- Returns attributes.
- 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.
- getCookieOptions() : array<string|int, mixed>
- Store something in cookie temporarily.
- getFlashCookieObject() : mixed|null
- Return object and remove it from the cookie.
- getFlashObject() : mixed
- Return object and remove it from session.
- getId() : string|null
- Get session ID
- getInstance() : Session
- Get current session instance.
- getIterator() : ArrayIterator
- Retrieve an external iterator
- getName() : string|null
- Get session name
- init() : void
- Initialize session.
- instance() : Session
- invalidate() : $this
- Invalidates the current session.
- isStarted() : bool
- Checks if the session was started.
- regenerateId() : $this
- Regenerate session id but keep the current session information.
- setAutoStart() : $this
- setFlashCookieObject() : $this
- Store something in cookie temporarily.
- setFlashObject() : $this
- Store something in session temporarily.
- setId() : $this
- Set session ID
- setName() : $this
- Set session name
- setOptions() : void
- Sets session.* ini variables.
- start() : $this
- Starts the session storage
- started() : bool
- Checks if the session was started.
- isSessionStarted() : bool
- http://php.net/manual/en/function.session-status.php#113468 Check if session is started nicely.
- onBeforeSessionStart() : void
- onSessionStart() : void
- removeCookie() : void
- setCookie() : void
- setOption() : void
Properties
$autoStart
protected
bool
$autoStart
= false
$instance
protected
static Session
$instance
$options
protected
array<string|int, mixed>
$options
= []
$started
protected
bool
$started
= false
Methods
__construct()
Session constructor.
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
__get()
Returns session variable.
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
__isset()
Checks if session variable is defined.
public
__isset(mixed $name) : bool
Parameters
- $name : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
Return values
bool__set()
Sets session variable.
public
__set(mixed $name, mixed $value) : void
Parameters
- $name : mixed
- $value : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
__unset()
Removes session variable.
public
__unset(mixed $name) : void
Parameters
- $name : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
all()
Returns attributes.
public
all() : array<string|int, mixed>
Use ->getAll() method instead.
Return values
array<string|int, mixed> —Attributes
clear()
Free all session variables.
public
clear() : $this
Tags
Return values
$thisclose()
Force the session to be saved and closed
public
close() : $this
Tags
Return values
$thisgetAll()
Returns all session variables.
public
getAll() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCookieOptions()
Store something in cookie temporarily.
public
getCookieOptions([int|null $lifetime = null ]) : array<string|int, mixed>
Parameters
- $lifetime : int|null = null
Return values
array<string|int, mixed>getFlashCookieObject()
Return object and remove it from the cookie.
public
getFlashCookieObject(string $name) : mixed|null
Parameters
- $name : string
Tags
Return values
mixed|nullgetFlashObject()
Return object and remove it from session.
public
getFlashObject(string $name) : mixed
Parameters
- $name : string
getId()
Get session ID
public
getId() : string|null
Tags
Return values
string|null —Session ID
getInstance()
Get current session instance.
public
static getInstance() : Session
Tags
Return values
SessiongetIterator()
Retrieve an external iterator
public
getIterator() : ArrayIterator
Tags
Attributes
- #[ReturnTypeWillChange]
Return values
ArrayIterator —Return an ArrayIterator of $_SESSION
getName()
Get session name
public
getName() : string|null
Tags
Return values
string|nullinit()
Initialize session.
public
init() : void
Code in this function has been moved into SessionServiceProvider class.
instance()
public
static instance() : Session
Use ->getInstance() method instead.
Return values
Sessioninvalidate()
Invalidates the current session.
public
invalidate() : $this
Tags
Return values
$thisisStarted()
Checks if the session was started.
public
isStarted() : bool
Tags
Return values
boolregenerateId()
Regenerate session id but keep the current session information.
public
regenerateId() : $this
Session id must be regenerated on login, logout or after long time has been passed.
Tags
Return values
$thissetAutoStart()
public
setAutoStart(bool $auto) : $this
Parameters
- $auto : bool
Return values
$thissetFlashCookieObject()
Store something in cookie temporarily.
public
setFlashCookieObject(string $name, mixed $object[, int $time = 60 ]) : $this
Parameters
- $name : string
- $object : mixed
- $time : int = 60
Tags
Return values
$thissetFlashObject()
Store something in session temporarily.
public
setFlashObject(string $name, mixed $object) : $this
Parameters
- $name : string
- $object : mixed
Return values
$thissetId()
Set session ID
public
setId(mixed $id) : $this
Parameters
- $id : mixed
-
Session ID
Tags
Return values
$thissetName()
Set session name
public
setName(mixed $name) : $this
Parameters
- $name : mixed
Tags
Return values
$thissetOptions()
Sets session.* ini variables.
public
setOptions(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
Tags
start()
Starts the session storage
public
start([mixed $readonly = false ]) : $this
Parameters
- $readonly : mixed = false
Tags
Return values
$thisstarted()
Checks if the session was started.
public
started() : bool
Use ->isStarted() method instead.
Return values
boolisSessionStarted()
http://php.net/manual/en/function.session-status.php#113468 Check if session is started nicely.
protected
isSessionStarted() : bool
Return values
boolonBeforeSessionStart()
protected
onBeforeSessionStart() : void
onSessionStart()
protected
onSessionStart() : void
removeCookie()
protected
removeCookie() : void
setCookie()
protected
setCookie() : void
setOption()
protected
setOption(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed