Created
June 5, 2016 19:21
-
-
Save cballou/b4f6117e0b4e4929f249336e8225d7f4 to your computer and use it in GitHub Desktop.
MongoSession example usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('MongoSession.php'); | |
// the config array for loading MongoDB servers | |
$config = array( | |
// cookie related vars | |
'cookie_path' => '/', | |
'cookie_domain' => '.mydomain.com', // .mydomain.com | |
// session related vars | |
'lifetime' => 3600, // session lifetime in seconds | |
'database' => 'session', // name of MongoDB database | |
'collection' => 'session', // name of MongoDB collection | |
// array of mongo db servers | |
'servers' => array( | |
array( | |
'host' => Mongo::DEFAULT_HOST, | |
'port' => Mongo::DEFAULT_PORT, | |
'username' => null, | |
'password' => null, | |
'persistent' => false | |
) | |
) | |
); | |
$session = new MongoSession($config); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('MongoSession.php'); | |
$session = new MongoSession(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment