t4web / session
ZF2 Module. Initializing SessionManager.
2.0.0
2018-07-27 10:00 UTC
Requires
- php: >=5.5.0
- zendframework/zend-db: 2.9.*
- zendframework/zend-mvc: 3.1.*
- zendframework/zend-session: 2.8.*
Requires (Dev)
- phpunit/phpunit: ~4.5
- squizlabs/php_codesniffer: ^2.3
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;