How to Use MongoDB for Session Storage with Lithium

Step 1

Download this file to app/extensions/adapter/storage/session/Model.php

Step 2

Create a starter app/models/Sessions.php:

<?
namespace app\models;
class Sessions extends \lithium\data\Model {

}
?>

Step 3

Configure app/config/bootstrap/session.php to use the new extension:

Session::config(array(
 'cookie' => array('adapter' => 'Cookie', 'name' => $name),
 'default' => array('adapter' => 'Model', 'session.name' => $name, 'model' => 'Sessions')
 ));
Advertisements