Session
in
Table of Contents
- all() : array<string|int, mixed>
- Get all of the session data.
- exists() : bool
- Checks if a key exists.
- flush() : void
- Remove all of the items from the session.
- forget() : void
- Remove one or many items from the session.
- get() : mixed
- Get an item from the session.
- getHandler() : SessionHandlerInterface
- Get the session handler instance.
- getId() : string
- Get the current session ID.
- getName() : string
- Get the name of the session.
- handlerNeedsRequest() : bool
- Determine if the session handler needs a request.
- has() : bool
- Checks if an a key is present and not null.
- isStarted() : bool
- Determine if the session has been started.
- migrate() : bool
- Generate a new session ID for the session.
- previousUrl() : string|null
- Get the previous URL from the session.
- put() : void
- Put a key / value pair or array of key / value pairs in the session.
- remove() : mixed
- Remove an item from the session, returning its value.
- save() : bool
- Save the session data to storage.
- setId() : void
- Set the session ID.
- setPreviousUrl() : void
- Set the "previous" URL in the session.
- setRequestOnHandler() : void
- Set the request on the handler instance.
- start() : bool
- Start the session, reading the data from a handler.
- token() : string
- Get the CSRF token value.
Methods
all()
Get all of the session data.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —exists()
Checks if a key exists.
public
exists(string|array<string|int, mixed> $key) : bool
Parameters
- $key : string|array<string|int, mixed>
Return values
bool —flush()
Remove all of the items from the session.
public
flush() : void
Return values
void —forget()
Remove one or many items from the session.
public
forget(string|array<string|int, mixed> $keys) : void
Parameters
- $keys : string|array<string|int, mixed>
Return values
void —get()
Get an item from the session.
public
get(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
Return values
mixed —getHandler()
Get the session handler instance.
public
getHandler() : SessionHandlerInterface
Return values
SessionHandlerInterface —getId()
Get the current session ID.
public
getId() : string
Return values
string —getName()
Get the name of the session.
public
getName() : string
Return values
string —handlerNeedsRequest()
Determine if the session handler needs a request.
public
handlerNeedsRequest() : bool
Return values
bool —has()
Checks if an a key is present and not null.
public
has(string|array<string|int, mixed> $key) : bool
Parameters
- $key : string|array<string|int, mixed>
Return values
bool —isStarted()
Determine if the session has been started.
public
isStarted() : bool
Return values
bool —migrate()
Generate a new session ID for the session.
public
migrate([bool $destroy = false ]) : bool
Parameters
- $destroy : bool = false
Return values
bool —previousUrl()
Get the previous URL from the session.
public
previousUrl() : string|null
Return values
string|null —put()
Put a key / value pair or array of key / value pairs in the session.
public
put(string|array<string|int, mixed> $key[, mixed $value = null ]) : void
Parameters
- $key : string|array<string|int, mixed>
- $value : mixed = null
Return values
void —remove()
Remove an item from the session, returning its value.
public
remove(string $key) : mixed
Parameters
- $key : string
Return values
mixed —save()
Save the session data to storage.
public
save() : bool
Return values
bool —setId()
Set the session ID.
public
setId(string $id) : void
Parameters
- $id : string
Return values
void —setPreviousUrl()
Set the "previous" URL in the session.
public
setPreviousUrl(string $url) : void
Parameters
- $url : string
Return values
void —setRequestOnHandler()
Set the request on the handler instance.
public
setRequestOnHandler(Request $request) : void
Parameters
- $request : Request
Return values
void —start()
Start the session, reading the data from a handler.
public
start() : bool
Return values
bool —token()
Get the CSRF token value.
public
token() : string