PHP Classes

session vs singleton

Recommend this page to a friend!

      PHP Classes blog  >  Fix the AJAX Requests...  >  All threads  >  session vs singleton  >  (Un) Subscribe thread alerts  
Subject:session vs singleton
Summary:session vs singleton
Author:Yoni Lamri
Date:2015-05-05 08:28:49
Update:2015-05-05 08:54:43

  1. session vs singleton   Reply   Report abuse  
Picture of Yoni Lamri Yoni Lamri - 2015-05-05 08:41:52
I don't like basic session handlier for readOnly data, so i really like to store session data one time in a configuration class with static attribute called via a singleton pattern by an ajax controller.
$_SESSION['user'] become CONF::getInstance()->getSessionData('user').
I can also use this to store objects.
ex: CONF::getInstance()->getSessionData('user')->setName('xxx')->update()...

  2. Re: session vs singleton   Reply   Report abuse  
Picture of Eslam Mahmoud Eslam Mahmoud - 2015-05-05 08:54:43 - In reply to message 1 from Yoni Lamri
It will be greate if there a class you use and can share it with us to try it