PHP code example of hrevert / ht-session

1. Go to this page and download the library: Download hrevert/ht-session library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hrevert / ht-session example snippets


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

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'
      ]
   ]
];

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

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