interface
Session (View source)
Methods
string
getName()
Get the name of the session.
void
setName(string $name)
Set the name of the session.
string
getId()
Get the current session ID.
void
setId(string $id)
Set the session ID.
bool
start()
Start the session, reading the data from a handler.
void
save()
Save the session data to storage.
array
all()
Get all of the session data.
bool
exists(string|array $key)
Checks if a key exists.
bool
has(string|array $key)
Checks if a key is present and not null.
mixed
get(string $key, mixed $default = null)
Get an item from the session.
mixed
pull(string $key, mixed $default = null)
Get the value of a given key and then forget it.
void
put(string|array $key, mixed $value = null)
Put a key / value pair or array of key / value pairs in the session.
void
flash(string $key, mixed $value = true)
Flash a key / value pair to the session.
string
token()
Get the CSRF token value.
mixed
remove(string $key)
Remove an item from the session, returning its value.
void
forget(string|array $keys)
Remove one or many items from the session.
void
flush()
Remove all of the items from the session.
bool
invalidate()
Flush the session data and regenerate the ID.
bool
regenerate(bool $destroy = false)
Generate a new session identifier.
bool
migrate(bool $destroy = false)
Generate a new session ID for the session.
bool
isStarted()
Determine if the session has been started.
Details
Get the name of the session.
void
setName(string $name)
Set the name of the session.
Get the current session ID.
Start the session, reading the data from a handler.
Save the session data to storage.
Get all of the session data.
bool
exists(string|array $key)
bool
has(string|array $key)
Checks if a key is present and not null.
mixed
get(string $key, mixed $default = null)
Get an item from the session.
mixed
pull(string $key, mixed $default = null)
Get the value of a given key and then forget it.
void
put(string|array $key, mixed $value = null)
Put a key / value pair or array of key / value pairs in the session.
void
flash(string $key, mixed $value = true)
Flash a key / value pair to the session.
Get the CSRF token value.
void
regenerateToken()
Regenerate the CSRF token value.
mixed
remove(string $key)
Remove an item from the session, returning its value.
void
forget(string|array $keys)
Remove one or many items from the session.
Remove all of the items from the session.
Flush the session data and regenerate the ID.
bool
regenerate(bool $destroy = false)
Generate a new session identifier.
bool
migrate(bool $destroy = false)
Generate a new session ID for the session.
Determine if the session has been started.
string|null
previousUrl()
Get the previous URL from the session.
void
setPreviousUrl(string $url)
Set the "previous" URL in the session.
Get the session handler instance.
bool
handlerNeedsRequest()
Determine if the session handler needs a request.
Set the request on the handler instance.