district5 / simple-session-store
SimpleSessionStore is a session management library for PHP
Installs: 140
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/district5/simple-session-store
Requires
- php: >=7.4
README
SimpleSessionStore is a session management library for PHP. It was originally part of OhSession.
Class overview:
\District5\SimpleSessionStore\Session
- Controls the basic Session functionality that's needed for applications of any size. The primary goal of this class is to provide a simplistic interface to interact with session data.
\District5\SimpleSessionStore\Storage
- Provides a Session Namespace approach to storing data for a users session.
Usage
- Example Composer file contents:
{ "require": { "district5/simple-session-store": ">=1.1.0" } }
- Set a value:
<?php $sess = \District5\SimpleSessionStore\Session::getInstance(); if ($sess->set('foo', 'bar') === true) { // set ok. }
- Get a value:
<?php $sess = \District5\SimpleSessionStore\Session::getInstance(); $val = $sess->get('foo'); if ($val !== false) { // get ok }
- Remove a key:
<?php $sess = \District5\SimpleSessionStore\Session::getInstance(); if ($sess->remove('foo') === true) { // remove ok }
- Remove all keys:
<?php $sess = \District5\SimpleSessionStore\Session::getInstance(); if ($sess->removeAll() === true) { // remove all ok }
- Destroy the session (and optionally regenerate):
<?php $sess = \District5\SimpleSessionStore\Session::getInstance(); if ($sess->destroy(true) === true) { // or pass false if you don't want to regenerate a session. // destroy ok }