tflori/nb-sessions

Non-Blocking-Sessions made easy

v1.1.0 2017-10-18 05:25 UTC

This package is auto-updated.

Last update: 2022-01-15 16:06:17 UTC


README

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.