The Session Manager

The SessionManager package is in charge of managing the session for you.

Why do we need a session manager?

PHP offers a simple way to start sessions: the session_start function. So you would we ever need to use another session mechanism?

Well, sessions can be configured in a lot of different ways. You can use session_set_save_handler to change completely the way sessions work. For instance, if you use Drupal, the sessions are stored in database. You could also configure your application to use a special "session handler".

In Mouf, some components may need to access the session the way you do. So we decided to provide a simple way to initialize sessions. As a bonus, the SessionManager offers a lot of settings for managing your session graphically.

Using the session manager

Just enable the package in your project. When the package is enabled, you have a sessionManager instance create.

To start a session, use:


To write and close a session, use:


To destroy a session, use:


The DefaultSessionManager class

The DefaultSessionManager uses the standard PHP mechanism to track sessions. It offers a number of parameters to configure the lifetime of a session, the path where session files are stored...


Found a typo? Something is wrong in this documentation? Just fork and edit it!