Skip to content

tflori/nb-sessions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NbSessions

Build Status Coverage Status Latest Stable Version Total Downloads License

A non-blocking session handler for PHP. This library is inspired by duncan3dc/sessions.

Examples

basic

$session = new \NbSessions\SessionInstance('my-app');
$session->set('login', 'jdoe');
$login = $session->get('login');

namespaces

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'

static class

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');

Setup

Install it via composer and use without configuration.

composer require tflori/nb-sessions

Read the docs for more information.