Store
class Store implements Session
Properties
protected string | $id | The session ID. |
|
protected string | $name | The session name. |
|
protected array | $attributes | The session attributes. |
|
protected SessionHandlerInterface | $handler | The session handler implementation. |
|
protected bool | $started | Session store started status. |
Methods
Create a new session instance.
Start the session, reading the data from a handler.
Load the session data from the handler.
Read the session data from the handler.
Prepare the raw string data from the session for unserialization.
Save the session data to storage.
Prepare the serialized session data for storage.
Age the flash data for the session.
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.
Determine if the session contains old input.
Get the requested item from the flashed input array.
Replace the given session attributes entirely.
Put a key / value pair or array of key / value pairs in the session.
Push a value onto a session array.
Increment the value of an item in the session.
Decrement the value of an item in the session.
Flash a key / value pair to the session.
Flash a key / value pair to the session for immediate use.
Reflash all of the session flash data.
Reflash a subset of the current flash data.
Merge new flash keys into the new flash array.
Remove the given keys from the old flash data.
Flash an input array to the session.
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.
Get the name of the session.
Set the name of the session.
Get the current session ID.
Set the session ID.
Determine if this is a valid session ID.
Get a new, random session ID.
Set the existence of the session on the handler if applicable.
Get the CSRF token value.
Regenerate the CSRF token value.
Get the previous URL from the session.
Set the "previous" URL in the session.
Get the underlying session handler implementation.
Determine if the session handler needs a request.
Details
at line 56
void
__construct(string $name, SessionHandlerInterface $handler, string|null $id = null)
Create a new session instance.
at line 68
bool
start()
Start the session, reading the data from a handler.
at line 84
protected void
loadSession()
Load the session data from the handler.
at line 94
protected array
readFromHandler()
Read the session data from the handler.
at line 113
protected string
prepareForUnserialize(string $data)
Prepare the raw string data from the session for unserialization.
at line 123
bool
save()
Save the session data to storage.
at line 140
protected string
prepareForStorage(string $data)
Prepare the serialized session data for storage.
at line 150
void
ageFlashData()
Age the flash data for the session.
at line 164
array
all()
Get all of the session data.
at line 175
bool
exists(string|array $key)
Checks if a key exists.
at line 188
bool
has(string|array $key)
Checks if a key is present and not null.
at line 202
mixed
get(string $key, mixed $default = null)
Get an item from the session.
at line 214
mixed
pull(string $key, string $default = null)
Get the value of a given key and then forget it.
at line 225
bool
hasOldInput(string $key = null)
Determine if the session contains old input.
at line 239
mixed
getOldInput(string $key = null, mixed $default = null)
Get the requested item from the flashed input array.
at line 250
void
replace(array $attributes)
Replace the given session attributes entirely.
at line 262
void
put(string|array $key, mixed $value = null)
Put a key / value pair or array of key / value pairs in the session.
at line 280
mixed
remember(string $key, Closure $callback)
Get an item from the session, or store the default value.
at line 298
void
push(string $key, mixed $value)
Push a value onto a session array.
at line 314
mixed
increment(string $key, int $amount = 1)
Increment the value of an item in the session.
at line 328
int
decrement(string $key, int $amount = 1)
Decrement the value of an item in the session.
at line 340
void
flash(string $key, mixed $value)
Flash a key / value pair to the session.
at line 356
void
now(string $key, mixed $value)
Flash a key / value pair to the session for immediate use.
at line 368
void
reflash()
Reflash all of the session flash data.
at line 381
void
keep(array|mixed $keys = null)
Reflash a subset of the current flash data.
at line 394
protected void
mergeNewFlashes(array $keys)
Merge new flash keys into the new flash array.
at line 407
protected void
removeFromOldFlashData(array $keys)
Remove the given keys from the old flash data.
at line 418
void
flashInput(array $value)
Flash an input array to the session.
at line 429
mixed
remove(string $key)
Remove an item from the session, returning its value.
at line 440
void
forget(string|array $keys)
Remove one or many items from the session.
at line 450
void
flush()
Remove all of the items from the session.
at line 460
bool
invalidate()
Flush the session data and regenerate the ID.
at line 473
bool
regenerate(bool $destroy = false)
Generate a new session identifier.
at line 484
bool
migrate(bool $destroy = false)
Generate a new session ID for the session.
at line 502
bool
isStarted()
Determine if the session has been started.
at line 512
string
getName()
Get the name of the session.
at line 523
void
setName(string $name)
Set the name of the session.
at line 533
string
getId()
Get the current session ID.
at line 544
void
setId(string $id)
Set the session ID.
at line 555
bool
isValidId(string $id)
Determine if this is a valid session ID.
at line 565
protected string
generateSessionId()
Get a new, random session ID.
at line 576
void
setExists(bool $value)
Set the existence of the session on the handler if applicable.
at line 588
string
token()
Get the CSRF token value.
at line 598
void
regenerateToken()
Regenerate the CSRF token value.
at line 608
string|null
previousUrl()
Get the previous URL from the session.
at line 619
void
setPreviousUrl(string $url)
Set the "previous" URL in the session.
at line 629
SessionHandlerInterface
getHandler()
Get the underlying session handler implementation.
at line 639
bool
handlerNeedsRequest()
Determine if the session handler needs a request.
at line 650
void
setRequestOnHandler(Request $request)
Set the request on the handler instance.