vakata / session
A simple key-value storage class
Installs: 3 888
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >=8.0
- vakata/cache: >=3.0.0
- vakata/database: ^4.0.0|^5.0.0
- vakata/kvstore: >=1.0.2
README
A simple key-value storage class. used for configurations and extended in vakata/session.
Install
Via Composer
$ composer require vakata/session
Usage
Using the $_SESSION
superglobal is perfectly fine and works well with this class.
$session = new \vakata\session\Session(); // autostarts session and applies useful defaults $session->get('value'); // same as $_SESSION['value']; $session->set('val.ue', 2); // same as $_SESSION['val'] = [ 'ue' => 1 ]; $session->del('value'); // same as unset($_SESSION['value']); // optionally sessions can be stored in a database $sessionDB = new \vakata\session\Session( true, // autostart new \vakata\sessions\handler\SessionDatabase( new \vakata\database\DB('mysqli://user:pass@host/database'), 'table' ) ); // optionally sessions can be stored in memcached / filecache / database $sessionDB = new \vakata\session\Session( true, // autostart new \vakata\sessions\handler\SessionCache( new \vakata\cache\Memcache(), 'namespace' // this allows easy clearing ) );
For more on setting, getting and deleting values read here: https://github.com/vakata/kvstore
For more on the database class read here: https://github.com/vakata/database
For more on the memcached class read here: https://github.com/vakata/cache
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email github@vakata.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.