interface SessionInterface
Interface for the session.
Methods
bool | start() Starts the session storage. | |
string | getId() Returns the session ID. | |
setId(string $id) Sets the session ID. | ||
mixed | getName() Returns the session name. | |
setName(string $name) Sets the session name. | ||
bool | invalidate(int $lifetime = null) Invalidates the current session. | |
bool | migrate(bool $destroy = false, int $lifetime = null) Migrates the current session to a new session id while maintaining all session attributes. | |
save() Force the session to be saved and closed. | ||
bool | has(string $name) Checks if an attribute is defined. | |
mixed | get(string $name, mixed $default = null) Returns an attribute. | |
set(string $name, mixed $value) Sets an attribute. | ||
array | all() Returns attributes. | |
replace(array $attributes) Sets attributes. | ||
mixed | remove(string $name) Removes an attribute. | |
clear() Clears all attributes. | ||
bool | isStarted() Checks if the session was started. | |
registerBag(SessionBagInterface $bag) Registers a SessionBagInterface with the session. | ||
SessionBagInterface | getBag(string $name) Gets a bag instance by name. | |
MetadataBag | getMetadataBag() Gets session meta. |
Details
bool start()
Starts the session storage.
string getId()
Returns the session ID.
setId(string $id)
Sets the session ID.
mixed getName()
Returns the session name.
setName(string $name)
Sets the session name.
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.
bool migrate(bool $destroy = false, int $lifetime = null)
Migrates the current session to a new session id while maintaining all session attributes.
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.
bool has(string $name)
Checks if an attribute is defined.
mixed get(string $name, mixed $default = null)
Returns an attribute.
set(string $name, mixed $value)
Sets an attribute.
array all()
Returns attributes.
replace(array $attributes)
Sets attributes.
mixed remove(string $name)
Removes an attribute.
clear()
Clears all attributes.
bool isStarted()
Checks if the session was started.
registerBag(SessionBagInterface $bag)
Registers a SessionBagInterface with the session.
SessionBagInterface getBag(string $name)
Gets a bag instance by name.
MetadataBag getMetadataBag()
Gets session meta.
Please login to continue.