humble/session

dev-master 2016-02-28 22:32 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:07:47 UTC


README

Latest Version Software License Build Status

HUMBLE Session

Install

Via Composer

$ composer require humble/session

Usage

Start PHP Session.

\Humble\Session\Session::start();

Start PHP Session with custom cookie params.

\Humble\Session\Session::start(array('lifetime' => 3600));

Create table for Pdo Session.

CREATE TABLE `sessions` (
  `id` char(26) NOT NULL,
  `time` int(10) unsigned NOT NULL,
  `data` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Start Pdo Session.

$handler = new \Humble\Session\PdoSessionHandler($pdo);
\Humble\Session\Session::start(array('lifetime' => 3600), $handler);

Get Pdo Session Handler with custom settings.

$handler = new \Humble\Session\PdoSessionHandler($pdo, [
    'tableName' => 'sessions',
    'idField' => 'id',
    'timeField' => 'time',
    'dataField' => 'data',
]);

License

The MIT License (MIT). Please see License File for more information.