t4web/session

ZF2 Module. Initializing SessionManager.

2.0.0 2018-07-27 10:00 UTC

This package is auto-updated.

Last update: 2024-10-26 18:33:32 UTC


README

ZF2 Module. Initializing and configuring SessionManager. See ZF2 Session Manager documentation

Instalation

Add to your composer.json:

"t4web/session": "^1.0"

And to your config/application.config.php:

'modules' => [
    // ...
    'T4web\Session',
    // ...
],

Storage sessions in Db table

By Default session store by native php engine, if you want store sessions in Db add to your global.config.php:

'session' => [
    'config' => [
        'options' => [
            'gc_maxlifetime' => 86400,
        ],
    ],
    'save_handler' => T4web\Session\SaveHandler\DbTableGateway::class,
    'save_handler_options' => [
        'db_table' => [
            'table' => 'sessions'
        ],
    ],
],

And create table sessions:

CREATE TABLE IF NOT EXISTS `sessions` (
    `id` varchar(32) NOT NULL,
    `name` varchar(32) NOT NULL,
    `modified` int(11),
    `lifetime` int(11),
    `data` text DEFAULT NULL,
    PRIMARY KEY (`id`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;