| « Redirect output to /dev/null... mainly ! | Wrap the wrapper that is already wrapped in a wrapper... huh ??? » |
PHP Session management - The middle of a month is wrapped... ...yes wrappers again !
PHP Add commentsThe middle of a month is wrapped in the start of the month and the end of a month...
yes! you got it! wrappers again...
Why would anyone need to wrap the session management of PHP ?
Rewriting internal PHP session management is like saying:
You guys (from Zend) have done such a poor job... I'm gonna do it myself all over again...
In PHP 3.0 there was PHPLib which wrapped the session management of PHP... to save data in MySQL rather that using flat files...
In a framework, I'm stuck with, the session management of PHP is also wrapped in some other fancy constructs...
Follow up:
Instead of writing 27 characters:
$_SESSION['alfa'] = 'beta';
I'm forced to write 67... not to mention that I'm going through 2 objects and 3 methods.
Also instead of writing 23 character:
echo $_SESSION['alfa'];
I'm again stuck in writing 63 characters.
Of course sometimes this will not be enough... but then again PHP provides you the mechanism for changing the session management of PHP but in such a way that is transparent to the programmer.
Yes it's the session_set_save_handler function !
You only have to write 6 functions that will take care of session management.
session_set_save_handler ( 'MyOpen', 'MyClose', 'MyRead', 'MyWrite', 'MyDestroy', 'MyGarbageCollector');
This is it.
Now you have your own session management but programmes will continue to use $_SESSION as if nothing happened.
Changing the way you work with sessions and PHP functionality in general, using wrappers over wrappers and CMSes build over frameworks has long term implications.
It changes the way you think and you will end up as a programmer addicted to that framework/wrapper/framework.
If you want a better session management you can go with memcached from Danga or something more session oriented: msession from Mohawk Software.
There are solutions to keep programmers to what they've learned as a junior...
They know that well...
let all programmers be comfortable...
you will gain more using dedicated software than using custom session handlers...
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Recent comments