joomla/session
Framework-agnostic PHP 8.1+ session management from the Joomla Framework. Provides interfaces and utilities to start and manage sessions, store and retrieve session data, and integrate session handling cleanly within your application.
The StorageInterface defines an class which represents a data store for session data.
The getName() method is used to read the session name.
/*
* [@return](https://github.com/return) string The session name
*/
public function getName(): string;
The setName() method is used to set the session name. In regular use, the Joomla\Session\Session object will inject the calculated session name into the storage instance.
/*
* [@param](https://github.com/param) string $name The session name
*
* [@return](https://github.com/return) $this
*/
public function setName(string $name);
The getId() method is used to read the session ID.
/*
* [@return](https://github.com/return) string The session ID
*/
public function getId(): string;
The setId() method is used to set the session ID. In regular use, the Joomla\Session\Session object will inject the calculated session ID into the storage instance.
/*
* [@param](https://github.com/param) string $name The session ID
*
* [@return](https://github.com/return) $this
*/
public function setId(string $name);
The isActive() method is used to check if there is an active session for the current request.
/*
* [@return](https://github.com/return) boolean
*/
public function isActive(): bool;
The isStarted() method is used to check if the active session for the current request has been started.
/*
* [@return](https://github.com/return) boolean
*/
public function isStarted(): bool;
The start() method is used to start a session if it has not already been started.
/**
* [@return](https://github.com/return) void
*/
public function start();
The regenerate() method is used to regenerate the current session ID.
Note, for implementations that interface with PHP's session extension, the session_regenerate_id() function must be called by this method.
/**
* [@param](https://github.com/param) boolean $destroy Destroy session when regenerating?
*
* [@return](https://github.com/return) boolean True on success
*/
public function regenerate(bool $destroy = false): bool;
The close() method is used to write the data to storage and close the current session.
/**
* [@return](https://github.com/return) void
*/
public function close();
The gc() method is used to trigger the garbage collection process for the backend storage.
/**
* [@return](https://github.com/return) integer|boolean Number of deleted sessions on success or boolean false on failure or if the function is unsupported
*/
public function gc();
The abort() method is used to abort the current session.
/**
* [@return](https://github.com/return) boolean
*/
public function abort();
The get() method is used to read the data for a given key from the data store, returning its current value or the given default value if the requested key was not found.
/*
* [@param](https://github.com/param) string $name Name of a variable
* [@param](https://github.com/param) mixed $default Default value of a variable if not set
*
* [@return](https://github.com/return) mixed Value of a variable
*/
public function get(string $name, $default);
The set() method is used to write data for a given key to the data store, returning its previous value if one was set.
/*
* [@param](https://github.com/param) string $name Name of a variable
* [@param](https://github.com/param) mixed $value Value of a variable
*
* [@return](https://github.com/return) mixed Old value of a variable
*/
public function set(string $name, $value);
The has() method is used to check if a given key has been set in the data store.
/*
* [@param](https://github.com/param) string $name Name of variable
*
* [@return](https://github.com/return) boolean
*/
public function has(string $name): bool;
The remove() method is used to remove a given key from the data store, returning its current value if set.
/*
* [@param](https://github.com/param) string $name Name of variable
*
* [@return](https://github.com/return) mixed The value from session or NULL if not set
*/
public function remove(string $name);
The clear() method is used to empty the data store.
/*
* [@return](https://github.com/return) void
*/
public function clear();
The all() method is used to fetch all data from the data store.
/*
* [@return](https://github.com/return) array
*/
public function all(): array;
How can I help you explore Laravel packages today?