Zend Framework: Using Zend Session and Session Namespace

17 Mar

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 March 19, 2009 at 3:04 pm #

    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 April 3, 2009 at 6:32 am #

    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. Faheem Abbas April 4, 2009 at 9:15 am #

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: