InterJinn

Development Framework For PHP

Sessions

Sessions are a staple of any major Web application. For those that don't know what they are, they provide a means to store and retrieve a visitor's data from one page to the next. There are many different ways to accomplish this task. From the get-go InterJinn provides two possible scenarios for session data storage. One is to store the data on the filesystem as small files, the other is to store the data in an SQL table (the exact SQL type depends on the database service which by default is MySQL). You can configure whichever option suits your needs best. Alternatively if you don't like either then you can write your own session service to accomplish whatever system you would like. Also note that InterJinn cooks up it's own session criteria via cookies as opposed to using URL rewriting.

What's special about InterJinn's sessions?

There's nothing altogether special about the InterJinn session management system other than it makes good use of the InterJinn framework itself, and is leveraged by the Property System to enable transparent session data handling. This behaviour; however, will exist for any properly constructed replacement session service. For users that prefer to directly manage the session data themselves (perhaps wanting to save out the data on a whim) the session service is easily retrieved in the same manner as any other service.

Example:
$sessionManager = &$this->getService( 'sessionManager' );
$session = &$sessionManager->do->getSession();
$session->do->setData( 'license/accepted', true ); $session->do->save();

That's pretty simple, and the system automatically uses either the filesystem or the database depending on what was configured. If you had declared a session property using the property system, then the above would be as simple as the following:

Example:
$this->licenseAccepted = true;

Where can I learn more about the session service?

You can learn more about the session service by reading the Session Service Documentation. The same documentation will provide you with a list of methods and functionality that must exist in your own session service should you choose to create a custom one. You might also find the general Service Documentation useful.