interface Session

Methods

string
getName()

Get the name of the session.

string
getId()

Get the current session ID.

void
setId(string $id)

Set the session ID.

bool
start()

Start the session, reading the data from a handler.

bool
save()

Save the session data to storage.

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.

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

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

string
token()

Get the CSRF token value.

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

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 12
string getName()

Get the name of the session.

Return Value

string

at line 19
string getId()

Get the current session ID.

Return Value

string

at line 27
void setId(string $id)

Set the session ID.

Parameters

string $id

Return Value

void

at line 34
bool start()

Start the session, reading the data from a handler.

Return Value

bool

at line 41
bool save()

Save the session data to storage.

Return Value

bool

at line 48
array all()

Get all of the session data.

Return Value

array

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

Checks if a key exists.

Parameters

string|array $key

Return Value

bool

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

Checks if an a key is present and not null.

Parameters

string|array $key

Return Value

bool

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

Get an item from the session.

Parameters

string $key
mixed $default

Return Value

mixed

at line 82
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 89
string token()

Get the CSRF token value.

Return Value

string

at line 97
mixed remove(string $key)

Remove an item from the session, returning its value.

Parameters

string $key

Return Value

mixed

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

Remove one or many items from the session.

Parameters

string|array $keys

Return Value

void

at line 112
void flush()

Remove all of the items from the session.

Return Value

void

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

Generate a new session ID for the session.

Parameters

bool $destroy

Return Value

bool

at line 127
bool isStarted()

Determine if the session has been started.

Return Value

bool

at line 134
string|null previousUrl()

Get the previous URL from the session.

Return Value

string|null

at line 142
void setPreviousUrl(string $url)

Set the "previous" URL in the session.

Parameters

string $url

Return Value

void

at line 149
SessionHandlerInterface getHandler()

Get the session handler instance.

at line 156
bool handlerNeedsRequest()

Determine if the session handler needs a request.

Return Value

bool

at line 164
void setRequestOnHandler(Request $request)

Set the request on the handler instance.

Parameters

Request $request

Return Value

void