title: Best way to deal with session handling in Zend Framework
body: <p>So I'm starting up in Zend framework and looking to implement a site-wide "User" session.... something I can easily access from ALL modules/controllers in the application.</p>
  
  <p>I'm like, should I make a new namespace in the library and extend the controller, like:</p>
  
  <pre><code>class MYCUSTOMLIB_Controller_Action extends Zend_Controller_Action
  {
      protected $_userSession;
  
      function preDispatch(Zend_Controller_Request_Abstract $req)
      {
           $this-&gt;_userSession = new Zend_Session_Namespace('user');
      }
  }
  </code></pre>
  
  <p>ANd then have all my controllers/modules/etc extend from that?</p>
  
  <p>Or should I create a Plugin or what?  How would you go about making this plugin to pass the user session to the controller?</p>
  
  <p>Or do I do it in the bootstrap??  Again how to pass to controller?</p>
  
  <p>Also should I use Zend_Session_Namespace or Zend_Http_Cookie and also how do I encrypt and xss clean the cookie or is that done automagically?</p>