Zend Framework

Zend Framework: Using Zend Session and Session Namespace

Posted by Faheem Abbas on March 17, 2009

Session handling was one of the boring topic in plan php atleast for me, but in Zend Framework it really shines. If you like to work with Object oriented programming, you will definitely become fan of it.

In this article I’m going to discuss some useful techniques of using Zend Framework Session and Session namespace.

Keep in mind that Both Zend_Session and Zend_Session_Namespace extends abstract class Zend_Session_Abstract. So both inherit methods avaliable in Zend_Session_Abstract automatically.

If you want to go under the hood, you can open Zend/Session/Abstract.php and have a look at the functions available.

Instead of delve into the function available, I’d rather discuss some useful techniques.

“Read full article here”, http://zendgeek.blogspot.com/2009/07/zend-framework-session-usage-and.html

3 Responses to “Zend Framework: Using Zend Session and Session Namespace”

  1. Djaarf said

    Also some action helper can be usefull:


    require_once 'Zend/Controller/Action/Helper/Abstract.php';
    require_once('Zend/Session.php');

    class My_Action_Helper_Session extends Zend_Controller_Action_Helper_Abstract
    {
    public function direct($namespace = 'Default')
    {
    return new Zend_Session_Namespace($namespace);
    }
    }

    Can be called in controllers


    $this->_helper->session()->foo = 'bar';

    or


    $this->_helper->session('Zend_Auth')->expiration = 3600;

  2. kapil said

    Thanks a lot , it was a great help … specially since we dont get good help/example anywhere on Zend framework , if u know some really good link where i can find most of the class/function list with there respective example , pls let me know

  3. you can find lots of useful resources here
    http://robertbasic.com/blog/online-resources-for-zend-framework/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>