class Store implements Session (View source)

Methods

void
__construct(string $name, SessionHandlerInterface $handler, string|null $id = null)

Create a new session instance.

bool
start()

Start the session, reading the data from a handler.

bool
save()

Save the session data to storage.

void
ageFlashData()

Age the flash data for the session.

array
all()

Get all of the session data.

bool
exists(string|array $key)

Checks if a key exists.

bool
has(string|array $key)

Checks if an a key is present and not null.

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

Get an item from the session.

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

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

bool
hasOldInput(string $key = null)

Determine if the session contains old input.

mixed
getOldInput(string $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)

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.

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 $id)

Determine if this is a valid 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.

getHandler()

Get 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.

Details

at line line 56
void __construct(string $name, SessionHandlerInterface $handler, string|null $id = null)

Create a new session instance.

Parameters

string $name
SessionHandlerInterface $handler
string|null $id

Return Value

void

at line line 68
bool start()

Start the session, reading the data from a handler.

Return Value

bool

at line line 123
bool save()

Save the session data to storage.

Return Value

bool

at line line 150
void ageFlashData()

Age the flash data for the session.

Return Value

void

at line line 164
array all()

Get all of the session data.

Return Value

array

at line line 175
bool exists(string|array $key)

Checks if a key exists.

Parameters

string|array $key

Return Value

bool

at line line 188
bool has(string|array $key)

Checks if an a key is present and not null.

Parameters

string|array $key

Return Value

bool

at line line 202
mixed get(string $key, mixed $default = null)

Get an item from the session.

Parameters

string $key
mixed $default

Return Value

mixed

at line line 214
mixed pull(string $key, string $default = null)

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

Parameters

string $key
string $default

Return Value

mixed

at line line 225
bool hasOldInput(string $key = null)

Determine if the session contains old input.

Parameters

string $key

Return Value

bool

at line line 239
mixed getOldInput(string $key = null, mixed $default = null)

Get the requested item from the flashed input array.

Parameters

string $key
mixed $default

Return Value

mixed

at line line 250
void replace(array $attributes)

Replace the given session attributes entirely.

Parameters

array $attributes

Return Value

void

at line line 262
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

at line line 280
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

at line line 298
void push(string $key, mixed $value)

Push a value onto a session array.

Parameters

string $key
mixed $value

Return Value

void

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

Increment the value of an item in the session.

Parameters

string $key
int $amount

Return Value

mixed

at line line 328
int decrement(string $key, int $amount = 1)

Decrement the value of an item in the session.

Parameters

string $key
int $amount

Return Value

int

at line line 340
void flash(string $key, mixed $value)

Flash a key / value pair to the session.

Parameters

string $key
mixed $value

Return Value

void

at line line 356
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

at line line 368
void reflash()

Reflash all of the session flash data.

Return Value

void

at line line 381
void keep(array|mixed $keys = null)

Reflash a subset of the current flash data.

Parameters

array|mixed $keys

Return Value

void

at line line 418
void flashInput(array $value)

Flash an input array to the session.

Parameters

array $value

Return Value

void

at line line 429
mixed remove(string $key)

Remove an item from the session, returning its value.

Parameters

string $key

Return Value

mixed

at line line 440
void forget(string|array $keys)

Remove one or many items from the session.

Parameters

string|array $keys

Return Value

void

at line line 450
void flush()

Remove all of the items from the session.

Return Value

void

at line line 460
bool invalidate()

Flush the session data and regenerate the ID.

Return Value

bool

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

Generate a new session identifier.

Parameters

bool $destroy

Return Value

bool

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

Generate a new session ID for the session.

Parameters

bool $destroy

Return Value

bool

at line line 502
bool isStarted()

Determine if the session has been started.

Return Value

bool

at line line 512
string getName()

Get the name of the session.

Return Value

string

at line line 523
void setName(string $name)

Set the name of the session.

Parameters

string $name

Return Value

void

at line line 533
string getId()

Get the current session ID.

Return Value

string

at line line 544
void setId(string $id)

Set the session ID.

Parameters

string $id

Return Value

void

at line line 555
bool isValidId(string $id)

Determine if this is a valid session ID.

Parameters

string $id

Return Value

bool

at line line 576
void setExists(bool $value)

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

Parameters

bool $value

Return Value

void

at line line 588
string token()

Get the CSRF token value.

Return Value

string

at line line 598
void regenerateToken()

Regenerate the CSRF token value.

Return Value

void

at line line 608
string|null previousUrl()

Get the previous URL from the session.

Return Value

string|null

at line line 619
void setPreviousUrl(string $url)

Set the "previous" URL in the session.

Parameters

string $url

Return Value

void

at line line 629
SessionHandlerInterface getHandler()

Get the underlying session handler implementation.

at line line 639
bool handlerNeedsRequest()

Determine if the session handler needs a request.

Return Value

bool

at line line 650
void setRequestOnHandler(Request $request)

Set the request on the handler instance.

Parameters

Request $request

Return Value

void