humble / session
HUMBLE Session
dev-master
2016-02-28 22:32 UTC
Requires
- php: >=7.0.0
- humble/standards: ~1.0
Requires (Dev)
- phpunit/phpunit: ~5.2
This package is not auto-updated.
Last update: 2025-01-04 21:30:32 UTC
README
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.