class EncryptedStore extends Store (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected string $id

The session ID.

from  Store
protected string $name

The session name.

from  Store
protected array $attributes

The session attributes.

from  Store
protected SessionHandlerInterface $handler

The session handler implementation.

from  Store
protected string $serialization

The session store's serialization strategy.

from  Store
protected bool $started

Session store started status.

from  Store
protected Encrypter $encrypter

The encrypter instance.

Methods

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, Encrypter $encrypter, string|null $id = null, string $serialization = 'php')

Create a new session instance.

bool
start()

Start the session, reading the data from a handler.

from  Store
void
loadSession()

Load the session data from the handler.

from  Store
array
readFromHandler()

Read the session data from the handler.

from  Store
string
prepareForUnserialize(string $data)

Prepare the raw string data from the session for unserialization.

void
marshalErrorBag()

Marshal the ViewErrorBag when using JSON serialization for sessions.

from  Store
void
save()

Save the session data to storage.

from  Store
void
prepareErrorBagForSerialization()

Prepare the ViewErrorBag instance for JSON serialization.

from  Store
string
prepareForStorage(string $data)

Prepare the serialized session data for storage.

void
ageFlashData()

Age the flash data for the session.

from  Store
array
all()

Get all of the session data.

from  Store
array
only(array $keys)

Get a subset of the session data.

from  Store
array
except(array $keys)

Get all the session data except for a specified array of items.

from  Store
bool
exists(string|array $key)

Checks if a key exists.

from  Store
bool
missing(string|array $key)

Determine if the given key is missing from the session data.

from  Store
bool
has(string|array $key)

Determine if a key is present and not null.

from  Store
bool
hasAny(string|array $key)

Determine if any of the given keys are present and not null.

from  Store
mixed
get(string $key, mixed $default = null)

Get an item from the session.

from  Store
mixed
pull(string $key, mixed $default = null)

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

from  Store
bool
hasOldInput(string|null $key = null)

Determine if the session contains old input.

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

Get the requested item from the flashed input array.

from  Store
void
replace(array $attributes)

Replace the given session attributes entirely.

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

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

from  Store
mixed
remember(string $key, Closure $callback)

Get an item from the session, or store the default value.

from  Store
void
push(string $key, mixed $value)

Push a value onto a session array.

from  Store
mixed
increment(string $key, int $amount = 1)

Increment the value of an item in the session.

from  Store
int
decrement(string $key, int $amount = 1)

Decrement the value of an item in the session.

from  Store
void
flash(string $key, mixed $value = true)

Flash a key / value pair to the session.

from  Store
void
now(string $key, mixed $value)

Flash a key / value pair to the session for immediate use.

from  Store
void
reflash()

Reflash all of the session flash data.

from  Store
void
keep(array|mixed $keys = null)

Reflash a subset of the current flash data.

from  Store
void
mergeNewFlashes(array $keys)

Merge new flash keys into the new flash array.

from  Store
void
removeFromOldFlashData(array $keys)

Remove the given keys from the old flash data.

from  Store
void
flashInput(array $value)

Flash an input array to the session.

from  Store
mixed
remove(string $key)

Remove an item from the session, returning its value.

from  Store
void
forget(string|array $keys)

Remove one or many items from the session.

from  Store
void
flush()

Remove all of the items from the session.

from  Store
bool
invalidate()

Flush the session data and regenerate the ID.

from  Store
bool
regenerate(bool $destroy = false)

Generate a new session identifier.

from  Store
bool
migrate(bool $destroy = false)

Generate a new session ID for the session.

from  Store
bool
isStarted()

Determine if the session has been started.

from  Store
string
getName()

Get the name of the session.

from  Store
void
setName(string $name)

Set the name of the session.

from  Store
string
id()

Get the current session ID.

from  Store
string
getId()

Get the current session ID.

from  Store
void
setId(string $id)

Set the session ID.

from  Store
bool
isValidId(string|null $id)

Determine if this is a valid session ID.

from  Store
string
generateSessionId()

Get a new, random session ID.

from  Store
void
setExists(bool $value)

Set the existence of the session on the handler if applicable.

from  Store
string
token()

Get the CSRF token value.

from  Store
void
regenerateToken()

Regenerate the CSRF token value.

from  Store
bool
hasPreviousUri()

Determine if the previous URI is available.

from  Store
Uri
previousUri()

Get the previous URL from the session as a URI instance.

from  Store
string|null
previousUrl()

Get the previous URL from the session.

from  Store
void
setPreviousUrl(string $url)

Set the "previous" URL in the session.

from  Store
void
passwordConfirmed()

Specify that the user has confirmed their password.

from  Store
getHandler()

Get the underlying session handler implementation.

from  Store
setHandler(SessionHandlerInterface $handler)

Set the underlying session handler implementation.

from  Store
bool
handlerNeedsRequest()

Determine if the session handler needs a request.

from  Store
void
setRequestOnHandler(Request $request)

Set the request on the handler instance.

from  Store
getEncrypter()

Get the encrypter instance.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct(string $name, SessionHandlerInterface $handler, Encrypter $encrypter, string|null $id = null, string $serialization = 'php')

Create a new session instance.

Parameters

string $name
SessionHandlerInterface $handler
Encrypter $encrypter
string|null $id
string $serialization

Return Value

void

bool start()

Start the session, reading the data from a handler.

Return Value

bool

protected void loadSession()

Load the session data from the handler.

Return Value

void

protected array readFromHandler()

Read the session data from the handler.

Return Value

array

protected string prepareForUnserialize(string $data)

Prepare the raw string data from the session for unserialization.

Parameters

string $data

Return Value

string

protected void marshalErrorBag()

Marshal the ViewErrorBag when using JSON serialization for sessions.

Return Value

void

void save()

Save the session data to storage.

Return Value

void

protected void prepareErrorBagForSerialization()

Prepare the ViewErrorBag instance for JSON serialization.

Return Value

void

protected string prepareForStorage(string $data)

Prepare the serialized session data for storage.

Parameters

string $data

Return Value

string

void ageFlashData()

Age the flash data for the session.

Return Value

void

array all()

Get all of the session data.

Return Value

array

array only(array $keys)

Get a subset of the session data.

Parameters

array $keys

Return Value

array

array except(array $keys)

Get all the session data except for a specified array of items.

Parameters

array $keys

Return Value

array

bool exists(string|array $key)

Checks if a key exists.

Parameters

string|array $key

Return Value

bool

bool missing(string|array $key)

Determine if the given key is missing from the session data.

Parameters

string|array $key

Return Value

bool

bool has(string|array $key)

Determine if a key is present and not null.

Parameters

string|array $key

Return Value

bool

bool hasAny(string|array $key)

Determine if any of the given keys are present and not null.

Parameters

string|array $key

Return Value

bool

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

Get an item from the session.

Parameters

string $key
mixed $default

Return Value

mixed

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

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

Parameters

string $key
mixed $default

Return Value

mixed

bool hasOldInput(string|null $key = null)

Determine if the session contains old input.

Parameters

string|null $key

Return Value

bool

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

Get the requested item from the flashed input array.

Parameters

string|null $key
mixed $default

Return Value

mixed

void replace(array $attributes)

Replace the given session attributes entirely.

Parameters

array $attributes

Return Value

void

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

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

Parameters

string|array $key
mixed $value

Return Value

void

mixed remember(string $key, Closure $callback)

Get an item from the session, or store the default value.

Parameters

string $key
Closure $callback

Return Value

mixed

void push(string $key, mixed $value)

Push a value onto a session array.

Parameters

string $key
mixed $value

Return Value

void

mixed increment(string $key, int $amount = 1)

Increment the value of an item in the session.

Parameters

string $key
int $amount

Return Value

mixed

int decrement(string $key, int $amount = 1)

Decrement the value of an item in the session.

Parameters

string $key
int $amount

Return Value

int

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

Flash a key / value pair to the session.

Parameters

string $key
mixed $value

Return Value

void

void now(string $key, mixed $value)

Flash a key / value pair to the session for immediate use.

Parameters

string $key
mixed $value

Return Value

void

void reflash()

Reflash all of the session flash data.

Return Value

void

void keep(array|mixed $keys = null)

Reflash a subset of the current flash data.

Parameters

array|mixed $keys

Return Value

void

protected void mergeNewFlashes(array $keys)

Merge new flash keys into the new flash array.

Parameters

array $keys

Return Value

void

protected void removeFromOldFlashData(array $keys)

Remove the given keys from the old flash data.

Parameters

array $keys

Return Value

void

void flashInput(array $value)

Flash an input array to the session.

Parameters

array $value

Return Value

void

mixed remove(string $key)

Remove an item from the session, returning its value.

Parameters

string $key

Return Value

mixed

void forget(string|array $keys)

Remove one or many items from the session.

Parameters

string|array $keys

Return Value

void

void flush()

Remove all of the items from the session.

Return Value

void

bool invalidate()

Flush the session data and regenerate the ID.

Return Value

bool

bool regenerate(bool $destroy = false)

Generate a new session identifier.

Parameters

bool $destroy

Return Value

bool

bool migrate(bool $destroy = false)

Generate a new session ID for the session.

Parameters

bool $destroy

Return Value

bool

bool isStarted()

Determine if the session has been started.

Return Value

bool

string getName()

Get the name of the session.

Return Value

string

void setName(string $name)

Set the name of the session.

Parameters

string $name

Return Value

void

string id()

Get the current session ID.

Return Value

string

string getId()

Get the current session ID.

Return Value

string

void setId(string $id)

Set the session ID.

Parameters

string $id

Return Value

void

bool isValidId(string|null $id)

Determine if this is a valid session ID.

Parameters

string|null $id

Return Value

bool

protected string generateSessionId()

Get a new, random session ID.

Return Value

string

void setExists(bool $value)

Set the existence of the session on the handler if applicable.

Parameters

bool $value

Return Value

void

string token()

Get the CSRF token value.

Return Value

string

void regenerateToken()

Regenerate the CSRF token value.

Return Value

void

bool hasPreviousUri()

Determine if the previous URI is available.

Return Value

bool

Uri previousUri()

Get the previous URL from the session as a URI instance.

Return Value

Uri

Exceptions

RuntimeException

string|null previousUrl()

Get the previous URL from the session.

Return Value

string|null

void setPreviousUrl(string $url)

Set the "previous" URL in the session.

Parameters

string $url

Return Value

void

void passwordConfirmed()

Specify that the user has confirmed their password.

Return Value

void

SessionHandlerInterface getHandler()

Get the underlying session handler implementation.

SessionHandlerInterface setHandler(SessionHandlerInterface $handler)

Set the underlying session handler implementation.

Parameters

SessionHandlerInterface $handler

Return Value

SessionHandlerInterface

bool handlerNeedsRequest()

Determine if the session handler needs a request.

Return Value

bool

void setRequestOnHandler(Request $request)

Set the request on the handler instance.

Parameters

Request $request

Return Value

void

Encrypter getEncrypter()

Get the encrypter instance.

Return Value

Encrypter