Session
interface Session
Methods
Get the name of the session.
Set the name of the session.
Get the current session ID.
Set the session ID.
Start the session, reading the data from a handler.
Save the session data to storage.
Get all of the session data.
Checks if a key exists.
Checks if a key is present and not null.
Get an item from the session.
Get the value of a given key and then forget it.
Put a key / value pair or array of key / value pairs in the session.
Replace the given session attributes entirely.
Flash a key / value pair to the session.
Flash an array of input to the session.
Reflash all of the session flash data.
Get a subset of the session data.
Determine if the flashed input contains an item.
Get the requested item from the flashed input array.
Get the CSRF token value.
Regenerate the CSRF token value.
Remove an item from the session, returning its value.
Remove one or many items from the session.
Remove all of the items from the session.
Flush the session data and regenerate the ID.
Generate a new session identifier.
Generate a new session ID for the session.
Determine if the session has been started.
Mark the session as read-only for the current request.
Determine if the session is read-only for the current request.
Get the previous URL from the session.
Set the "previous" URL in the session.
Specify that the user has confirmed their password.
Get the session handler instance.
Determine if the session handler needs a request.
Details
at line 17
string
getName()
Get the name of the session.
at line 22
void
setName(string $name)
Set the name of the session.
at line 28
string
getId()
Get the current session ID.
at line 33
void
setId(string|null $id)
Set the session ID.
at line 38
bool
start()
Start the session, reading the data from a handler.
at line 43
void
save()
Save the session data to storage.
at line 48
array
all()
Get all of the session data.
at line 53
bool
exists(array|UnitEnum|string $key)
Checks if a key exists.
at line 58
bool
has(array|UnitEnum|string $key)
Checks if a key is present and not null.
at line 63
mixed
get(UnitEnum|string $key, mixed $default = null)
Get an item from the session.
at line 68
mixed
pull(UnitEnum|string $key, mixed $default = null)
Get the value of a given key and then forget it.
at line 73
void
put(array|UnitEnum|string $key, mixed $value = null)
Put a key / value pair or array of key / value pairs in the session.
at line 78
void
replace(array $attributes)
Replace the given session attributes entirely.
at line 83
void
flash(UnitEnum|string $key, mixed $value = true)
Flash a key / value pair to the session.
at line 88
void
flashInput(array $value)
Flash an array of input to the session.
at line 93
void
reflash()
Reflash all of the session flash data.
at line 98
array
only(array $keys)
Get a subset of the session data.
at line 103
bool
hasOldInput(UnitEnum|string|null $key = null)
Determine if the flashed input contains an item.
at line 108
mixed
getOldInput(UnitEnum|string|null $key = null, mixed $default = null)
Get the requested item from the flashed input array.
at line 113
string|null
token()
Get the CSRF token value.
at line 118
void
regenerateToken()
Regenerate the CSRF token value.
at line 123
mixed
remove(UnitEnum|string $key)
Remove an item from the session, returning its value.
at line 128
void
forget(array|UnitEnum|string $keys)
Remove one or many items from the session.
at line 133
void
flush()
Remove all of the items from the session.
at line 138
bool
invalidate()
Flush the session data and regenerate the ID.
at line 143
bool
regenerate(bool $destroy = false)
Generate a new session identifier.
at line 148
bool
migrate(bool $destroy = false)
Generate a new session ID for the session.
at line 153
bool
isStarted()
Determine if the session has been started.
at line 158
void
markAsReadOnly()
Mark the session as read-only for the current request.
at line 163
bool
isReadOnly()
Determine if the session is read-only for the current request.
at line 168
string|null
previousUrl()
Get the previous URL from the session.
at line 173
void
setPreviousUrl(string $url)
Set the "previous" URL in the session.
at line 178
void
passwordConfirmed(string|null $guard = null)
Specify that the user has confirmed their password.
at line 183
SessionHandlerInterface
getHandler()
Get the session handler instance.
at line 188
bool
handlerNeedsRequest()
Determine if the session handler needs a request.
at line 193
void
setRequestOnHandler(Request $request)
Set the request on the handler instance.