PHP code example of lexpress / mongodb-service-provider

1. Go to this page and download the library: Download lexpress/mongodb-service-provider 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/ */

    

lexpress / mongodb-service-provider example snippets


use LExpress\Silex\MongoDBServiceProvider;

$app->register(new MongoDBServiceProvider('mongodb.db1'), array(
    'mongodb.db1.options' => array(
        'db' => 'articles',
        'replicaSet' => 'rs1',
    ),
));

$app->register(new MongoDBServiceProvider('mongodb.db2'), array(
    'mongodb.db2.options' => array(
        'db' => 'users',
        'username' => 'bar',
        'password' => 'secret',
    ),
));