SessionInterface
interface SessionInterface
Interface for the session.
Methods
Starts the session storage.
Returns the session ID.
Sets the session ID.
Returns the session name.
Sets the session name.
Invalidates the current session.
Migrates the current session to a new session id while maintaining all session attributes.
Force the session to be saved and closed.
Checks if an attribute is defined.
Returns an attribute.
Sets an attribute.
Returns attributes.
Sets attributes.
Removes an attribute.
Clears all attributes.
Checks if the session was started.
Gets a bag instance by name.
Gets session meta.
Details
at line line 30
bool
start()
Starts the session storage.
at line line 37
string
getId()
Returns the session ID.
at line line 44
setId(string $id)
Sets the session ID.
at line line 51
mixed
getName()
Returns the session name.
at line line 58
setName(string $name)
Sets the session name.
at line line 73
bool
invalidate(int $lifetime = null)
Invalidates the current session.
Clears all session attributes and flashes and regenerates the session and deletes the old session from persistence.
at line line 87
bool
migrate(bool $destroy = false, int $lifetime = null)
Migrates the current session to a new session id while maintaining all session attributes.
at line line 96
save()
Force the session to be saved and closed.
This method is generally not required for real sessions as the session will be automatically saved at the end of code execution.
at line line 105
bool
has(string $name)
Checks if an attribute is defined.
at line line 115
mixed
get(string $name, mixed $default = null)
Returns an attribute.
at line line 123
set(string $name, mixed $value)
Sets an attribute.
at line line 130
array
all()
Returns attributes.
at line line 137
replace(array $attributes)
Sets attributes.
at line line 146
mixed
remove(string $name)
Removes an attribute.
at line line 151
clear()
Clears all attributes.
at line line 158
bool
isStarted()
Checks if the session was started.
at line line 165
registerBag(SessionBagInterface $bag)
Registers a SessionBagInterface with the session.
at line line 174
SessionBagInterface
getBag(string $name)
Gets a bag instance by name.
at line line 181
MetadataBag
getMetadataBag()
Gets session meta.