- PHP Sessions stored within MongoDB.
- Supports session locking so it is safe to use with AJAX apps.
- Super duper easy to use.
This library is based on work originally from halfdan/MongoSession.
<?php
require_once('./MongoSessionHandler.php');
MongoSessionHandler::register('session', 'session'); // db and collection
?>
By default MongoSessionHandler will connect to MongoDB running on localhost. To set up a custom environment that uses many servers do this:
<?php
require_once('./MongoSessionHandler.php');
$conf = array(
// list of servers
'servers' => array('mongo1:27017', 'mongo2:27017', 'mongo3:27017'),
// options for connection
'options' => array(
'persist' => 'mongo-session',
'replicaSet' => true
)
);
MongoSessionHandler::register('session', 'session', $conf);
?>
When in doubt, read the code. Most of it is locking code and license comment anyways. :)
It’s MIT licensed.