A non-blocking session handler for PHP. This library is inspired by duncan3dc/sessions.
$session = new \NbSessions\SessionInstance('my-app');
$session->set('login', 'jdoe');
$login = $session->get('login');
To avoid key collisions you can use namespaces.
$session->set('foo', 'bar');
$namespace = $session->getNamespace('my-module');
$namespace->set('foo', 'baz');
$session->get('foo'); // 'bar'
$namespace->get('foo'); // 'baz'
For easier access you can use the static class. But remember: it's more hard to test.
$namespace = \NbSessions\Session::getNamespace('my-module');
\NbSessions\Session::get('foo');
Install it via composer and use without configuration.
composer require tflori/nb-sessions
Read the docs for more information.