Store
class Store implements Session (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
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 string | $serialization | The session store's serialization strategy. |
|
protected bool | $started | Session store started status. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
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.
Marshal the ViewErrorBag when using JSON serialization for sessions.
Save the session data to storage.
Prepare the ViewErrorBag instance for JSON serialization.
Prepare the serialized session data for storage.
Age the flash data for the session.
Get all of the session data.
Get a subset of the session data.
Get all the session data except for a specified array of items.
Checks if a key exists.
Determine if the given key is missing from the session data.
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.
Specify that the user has confirmed their password.
Get the underlying session handler implementation.
Determine if the session handler needs a request.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static void
flushMacros()
Flush the existing macros.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
void
__construct(string $name, SessionHandlerInterface $handler, string|null $id = null, string $serialization = 'php')
Create a new session instance.
bool
start()
Start the session, reading the data from a handler.
protected void
loadSession()
Load the session data from the handler.
protected array
readFromHandler()
Read the session data from the handler.
protected string
prepareForUnserialize(string $data)
Prepare the raw string data from the session for unserialization.
protected void
marshalErrorBag()
Marshal the ViewErrorBag when using JSON serialization for sessions.
void
save()
Save the session data to storage.
protected void
prepareErrorBagForSerialization()
Prepare the ViewErrorBag instance for JSON serialization.
protected string
prepareForStorage(string $data)
Prepare the serialized session data for storage.
void
ageFlashData()
Age the flash data for the session.
array
all()
Get all of the session data.
array
only(array $keys)
Get a subset of the session data.
array
except(array $keys)
Get all the session data except for a specified array of items.
bool
exists(string|array $key)
Checks if a key exists.
bool
missing(string|array $key)
Determine if the given key is missing from the session data.
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.
bool
hasOldInput(string|null $key = null)
Determine if the session contains old input.
mixed
getOldInput(string|null $key = null, mixed $default = null)
Get the requested item from the flashed input array.
void
replace(array $attributes)
Replace the given session attributes entirely.
void
put(string|array $key, mixed $value = null)
Put a key / value pair or array of key / value pairs in the session.
mixed
remember(string $key, Closure $callback)
Get an item from the session, or store the default value.
void
push(string $key, mixed $value)
Push a value onto a session array.
mixed
increment(string $key, int $amount = 1)
Increment the value of an item in the session.
int
decrement(string $key, int $amount = 1)
Decrement the value of an item in the session.
void
flash(string $key, mixed $value = true)
Flash a key / value pair to the session.
void
now(string $key, mixed $value)
Flash a key / value pair to the session for immediate use.
void
reflash()
Reflash all of the session flash data.
void
keep(array|mixed $keys = null)
Reflash a subset of the current flash data.
protected void
mergeNewFlashes(array $keys)
Merge new flash keys into the new flash array.
protected void
removeFromOldFlashData(array $keys)
Remove the given keys from the old flash data.
void
flashInput(array $value)
Flash an input array to the session.
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.
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
isValidId(string|null $id)
Determine if this is a valid session ID.
protected string
generateSessionId()
Get a new, random session ID.
void
setExists(bool $value)
Set the existence of the session on the handler if applicable.
string
token()
Get the CSRF token value.
void
regenerateToken()
Regenerate the CSRF token value.
string|null
previousUrl()
Get the previous URL from the session.
void
setPreviousUrl(string $url)
Set the "previous" URL in the session.
void
passwordConfirmed()
Specify that the user has confirmed their password.
SessionHandlerInterface
getHandler()
Get the underlying session handler implementation.
SessionHandlerInterface
setHandler(SessionHandlerInterface $handler)
Set the underlying session handler implementation.
bool
handlerNeedsRequest()
Determine if the session handler needs a request.
void
setRequestOnHandler(Request $request)
Set the request on the handler instance.