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 Session class is the default implementation of Joomla\Session\SessionInterface. In addition to implementing the interface, the Session class provides additional features such as lazily started sessions, validation of session data, and event hooks for allowing integrations to act on key events in the session lifetime.
The addValidator() method is used to add a validator for the current session, triggered immediately after the session is started. All validators must implement Joomla\Session\ValidatorInterface.
/**
* [@param](https://github.com/param) ValidatorInterface $validator The session validator
*
* [@return](https://github.com/return) void
*/
public function addValidator(ValidatorInterface $validator);
The getState() method is used to get the current state of the session.
/**
* Get current state of session
*
* [@return](https://github.com/return) string The session state
*/
public function getState();
When a session is started, the Session class dispatches the SessionEvents::START event to allow event listeners to perform extra actions after a session has been started. A Joomla\Session\SessionEvent instance is provided to listeners with the current Session instance.
Note, for backward compatibility the onAfterSessionStart event is also dispatched if any listeners are subscribed to that event, however this event is deprecated and will not be supported in the Joomla! Framework 3.0 release.
When a session is restarted, the Session class dispatches the SessionEvents::RESTART event to allow event listeners to perform extra actions after a session has been restarted. A Joomla\Session\SessionEvent instance is provided to listeners with the current Session instance.
Note, for backward compatibility the onAfterSessionRestart event is also dispatched if any listeners are subscribed to that event, however this event is deprecated and will not be supported in the Joomla! Framework 3.0 release.
How can I help you explore Laravel packages today?