interface Session

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|null $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(array|UnitEnum|string $key)

Checks if a key exists.

bool
has(array|UnitEnum|string $key)

Checks if a key is present and not null.

mixed
get(UnitEnum|string $key, mixed $default = null)

Get an item from the session.

mixed
pull(UnitEnum|string $key, mixed $default = null)

Get the value of a given key and then forget it.

void
put(array|UnitEnum|string $key, mixed $value = null)

Put a key / value pair or array of key / value pairs in the session.

void
replace(array $attributes)

Replace the given session attributes entirely.

void
flash(UnitEnum|string $key, mixed $value = true)

Flash a key / value pair to the session.

void
flashInput(array $value)

Flash an array of input to the session.

void
reflash()

Reflash all of the session flash data.

array
only(array $keys)

Get a subset of the session data.

bool
hasOldInput(UnitEnum|string|null $key = null)

Determine if the flashed input contains an item.

mixed
getOldInput(UnitEnum|string|null $key = null, mixed $default = null)

Get the requested item from the flashed input array.

string|null
token()

Get the CSRF token value.

void
regenerateToken()

Regenerate the CSRF token value.

mixed
remove(UnitEnum|string $key)

Remove an item from the session, returning its value.

void
forget(array|UnitEnum|string $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.

string|null
previousUrl()

Get the previous URL from the session.

void
setPreviousUrl(string $url)

Set the "previous" URL in the session.

void
passwordConfirmed(string|null $guard = null)

Specify that the user has confirmed their password.

getHandler()

Get the session handler instance.

bool
handlerNeedsRequest()

Determine if the session handler needs a request.

void
setRequestOnHandler(Request $request)

Set the request on the handler instance.

Details

at line 16
string getName()

Get the name of the session.

Return Value

string

at line 21
void setName(string $name)

Set the name of the session.

Parameters

string $name

Return Value

void

at line 26
string getId()

Get the current session ID.

Return Value

string

at line 31
void setId(string|null $id)

Set the session ID.

Parameters

string|null $id

Return Value

void

at line 36
bool start()

Start the session, reading the data from a handler.

Return Value

bool

at line 41
void save()

Save the session data to storage.

Return Value

void

at line 46
array all()

Get all of the session data.

Return Value

array

at line 51
bool exists(array|UnitEnum|string $key)

Checks if a key exists.

Parameters

array|UnitEnum|string $key

Return Value

bool

at line 56
bool has(array|UnitEnum|string $key)

Checks if a key is present and not null.

Parameters

array|UnitEnum|string $key

Return Value

bool

at line 61
mixed get(UnitEnum|string $key, mixed $default = null)

Get an item from the session.

Parameters

UnitEnum|string $key
mixed $default

Return Value

mixed

at line 66
mixed pull(UnitEnum|string $key, mixed $default = null)

Get the value of a given key and then forget it.

Parameters

UnitEnum|string $key
mixed $default

Return Value

mixed

at line 71
void put(array|UnitEnum|string $key, mixed $value = null)

Put a key / value pair or array of key / value pairs in the session.

Parameters

array|UnitEnum|string $key
mixed $value

Return Value

void

at line 76
void replace(array $attributes)

Replace the given session attributes entirely.

Parameters

array $attributes

Return Value

void

at line 81
void flash(UnitEnum|string $key, mixed $value = true)

Flash a key / value pair to the session.

Parameters

UnitEnum|string $key
mixed $value

Return Value

void

at line 86
void flashInput(array $value)

Flash an array of input to the session.

Parameters

array $value

Return Value

void

at line 91
void reflash()

Reflash all of the session flash data.

Return Value

void

at line 96
array only(array $keys)

Get a subset of the session data.

Parameters

array $keys

Return Value

array

at line 101
bool hasOldInput(UnitEnum|string|null $key = null)

Determine if the flashed input contains an item.

Parameters

UnitEnum|string|null $key

Return Value

bool

at line 106
mixed getOldInput(UnitEnum|string|null $key = null, mixed $default = null)

Get the requested item from the flashed input array.

Parameters

UnitEnum|string|null $key
mixed $default

Return Value

mixed

at line 111
string|null token()

Get the CSRF token value.

Return Value

string|null

at line 116
void regenerateToken()

Regenerate the CSRF token value.

Return Value

void

at line 121
mixed remove(UnitEnum|string $key)

Remove an item from the session, returning its value.

Parameters

UnitEnum|string $key

Return Value

mixed

at line 126
void forget(array|UnitEnum|string $keys)

Remove one or many items from the session.

Parameters

array|UnitEnum|string $keys

Return Value

void

at line 131
void flush()

Remove all of the items from the session.

Return Value

void

at line 136
bool invalidate()

Flush the session data and regenerate the ID.

Return Value

bool

at line 141
bool regenerate(bool $destroy = false)

Generate a new session identifier.

Parameters

bool $destroy

Return Value

bool

at line 146
bool migrate(bool $destroy = false)

Generate a new session ID for the session.

Parameters

bool $destroy

Return Value

bool

at line 151
bool isStarted()

Determine if the session has been started.

Return Value

bool

at line 156
string|null previousUrl()

Get the previous URL from the session.

Return Value

string|null

at line 161
void setPreviousUrl(string $url)

Set the "previous" URL in the session.

Parameters

string $url

Return Value

void

at line 166
void passwordConfirmed(string|null $guard = null)

Specify that the user has confirmed their password.

Parameters

string|null $guard

Return Value

void

at line 171
SessionHandlerInterface getHandler()

Get the session handler instance.

at line 176
bool handlerNeedsRequest()

Determine if the session handler needs a request.

Return Value

bool

at line 181
void setRequestOnHandler(Request $request)

Set the request on the handler instance.

Parameters

Request $request

Return Value

void