/session

A php session abstraction

Primary LanguagePHPMIT LicenseMIT

Agnostic php session library

Software License Scrutinizer Coverage Code Quality

A framework agnostic session library with convenient dot notation access.

Session handlers

Included:

  • Native php sessions
  • Simple database sessions via PDO (MySQL, Postgres,...)

External handlers:

You can implement any other handler or use other already existing implementations that implement the native php SessionHandlerInterface.

Example

This is a very simple example to give you an idea of how to use it:

use Phauthentic\Session\Session;
use Phauthentic\Session\Config as SessionConfig;

$config = (new SessionConfig())
    ->setSessionName('my-app')
    ->setGcMaxLifeTime(60);

$session = new Session($config);
$session->write('user', ['username' => 'foo']);

echo $session->read('user.username');

Copyright & License

Licensed under the MIT license.