Starting the Zend Framework 2 Session Manager

One way to start the session with Zend Framework 2 (2.0.3 dev) is as below written.

1
2
3
4
// public/index.php
$manager = new \Zend\Session\SessionManager();
$manager->getConfig()->setCookieHttpOnly(true)->setName('ac-session');
$manager->start();
  1. Start the session manager
  2. Get the session config object
  3. Set httpOnly cookies for better xss security
  4. Set your session name
  5. Start the session

There are many other options which i have not tested yet, but this options are mandatory in my opinion.

Lp. Silvester

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.