Skip to content

Phauthentic/session

Repository files navigation

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,...)
  • PSR 16 cache based session

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\Infrastructure\Http\Session\Session;
use Phauthentic\Infrastructure\Http\Session\Config as SessionConfig;

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

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

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

Copyright & License

Licensed under the MIT license.