| 
| Size: | 9238 | 
| Storage flags: | no_autoload,compress/gzip (30%) | 
Zend\Session\SaveHandler\MongoDB allows you to provide a MongoDB instance to be utilized as a session save handler. You provide the options in the Zend\Session\SaveHandler\MongoDBOptions class.
A basic example is one like the following:
1 2 3 4 5 6 7 8 9 10 11 12 13  | use Mongo;
use Zend\Session\SaveHandler\MongoDB;
use Zend\Session\SaveHandler\MongoDBOptions;
use Zend\Session\SessionManager;
$mongo = new Mongo();
$options = new MongoDBOptions(array(
    'database'   => 'myapp',
    'collection' => 'sessions',
));
$saveHandler = new MongoDB($mongo, $options);
$manager     = new SessionManager();
$manager->setSaveHandler($saveHandler);
 | 
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.