PHP code example of nicktacular / php-mongo-session

1. Go to this page and download the library: Download nicktacular/php-mongo-session library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nicktacular / php-mongo-session example snippets




MongoSession::config(array(
    'connection'    => 'mongodb://localhost:27017',
    'db'            => 'theDbName',
    'cookie_domain' => '.mydomain.com'
));

MongoSession::init();

MongoSession::config(array(
    'connection'        => 'mongodb://mongo1:27017,mongo2:27017',
    'connection_opts'   => array(
        'replicaSet'        =>'rs1',
        'connecttimeoutMS'  =>5000,
    ),
    'cookie_domain'     => '.mydomain.com',
    'db'                => 'theDbName'
);