bistro/session

A session abstraction library

0.1.0 2013-02-20 20:04 UTC

This package is not auto-updated.

Last update: 2024-12-15 03:54:06 UTC


README

A Session library for PHP 5.3+. Allows different storage engines to be used.

Engines

2 Storage engines are included in the library.

Native

This driver uses the php native $_SESSION array to handle the session data.

$session = new \Bistro\Session\Native;

$timeout = $session->get('timeout');

if ($timeout === null)
{
	$session->set('timeout', time() + 43200);
}

MockArray

There is also a MockArray storage engine to help with unit testing session data. The MockArray session doesn't save state across "requests".

$data = array(
	'test' => "Session data",
	'goes' => "Here"
)

$session = new \Bistro\Session\MockArray($data);

$session->has('test'); // true
$missing = $session->get('missing'); // null

Storage Interface

Check \Bistro\Session\Session for all of the public methods that are available to a session storage engine.