PHP code example of xp-forge / mongo-sessions

1. Go to this page and download the library: Download xp-forge/mongo-sessions 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/ */

    

xp-forge / mongo-sessions example snippets


use web\session\InMongoDB;
use com\mongodb\MongoConnection;

$conn= new MongoConnection('mongodb://localhost');
$sessions= new InMongoDB($conn->collection('test', 'sessions'));

$sessions= new InMongoDB($conn->collection('test', 'sessions'), InMongoDB::USING_TTL);