hrevert/ht-session

A Zend Framework 2 module to manage session configurations, session validators, storing session data in database.

Maintainers

👁 hrevert

Package info

github.com/hrevert/HtSession

pkg:composer/hrevert/ht-session

Statistics

Installs: 3 042

Dependents: 0

Suggesters: 0

Stars: 12

Open Issues: 2

1.2.0 2014-06-23 15:48 UTC

Requires (Dev)

None

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 63afaa8a47d2d91a53f647190d12d99a0d86028e

  • ojhaujjwal <bring2uo.woop@gmail.com>
  • Hrevert Technologies <info.woop@hrevert.com>

zf2modulesession

This package is auto-updated.

Last update: 2026-06-13 07:08:23 UTC


README

A Zend Framework 2 module to manage session configurations, session validators, storing session data in database.

##Requirements

##Installation

  • Add "hrevert/ht-session": "1.1.*", to your composer.json and run php composer.phar update
  • Enable the module in config/application.config.php
  • Copy file located in ./vendor/hrevert/ht-session/config/HtSession.global.php to ./config/autoload/HtSession.global.php and change the values as you wish

##Options

Check Options available in config/HtSession.global.php

##Features

  • Session configurations
  • Session set save handler
  • Session Validators

Session configurations

You can set all the session options as session name, save path etc.

return [
 'htsession' => [
 'config_options' => array(
 'name' => 'my_application',
 'save_path' => 'data/session'
 ),
 'storage' => 'Zend\Session\Storage\SessionArrayStorage',
 ]
];

Session set save handler

This module also comes with session set save handler to store session data in database. By default session_set_save_hander is already enabled. If you want to disable it, disable it in the following settings:

return [
 'htsession' => [
 'enable_session_set_save_handler' => true, // false if you don`t want to store session data in database
 ],
 'service_manager' => [
 'aliases' => [
 'HtSessionDbAdapter' => 'Zend\Db\Adapter\Adapter', // your database adapter here
 'HtSession\SessionSetSaveHandler' => 'HtSession\DefaultSessionSetSaveHandler'
 ]
 ]
];

Note: Dont forget to import schema available in data/mysql.sql to use session_set_save_handler

If you use Doctrine DBAL:

return [
 'service_manager' => [
 'aliases' => [
 'HtSession\SessionSetSaveHandler' => 'HtSession\DoctrineDbalSessionSetSaveHandler'
 ]
 ]
];

Session Validators

You can set validators provided by Zend Framework 2 with ease. Change the following as you wish in the config file:

return [
 'htsession' => [
 'validators' => array(
 'Zend\Session\Validator\RemoteAddr',
 'Zend\Session\Validator\HttpUserAgent', 
 ), 
 ]
];

For more detailed description, click here.

Ending Thoughts

Dont forget to fork this module and send pull request to make this module even better!

👁 Bitdeli Badge