Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

GromNaN/MongoDBServiceProvider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LExpress / MongoDBServiceProvider

Parameters

  • mongodb.server: (optional) Server to connect.
    Example: 'mongodb.server' => 'mongodb://127.0.0.1:27017,127.0.0.1:27018'

  • mongodb.options: Array of MongoDB options

  • db: DB name (required)

  • username: Authentication user

  • password: Authentication password

  • replicaSet: ReplicaSet name

Services

Using multiple connections

You can use many MongoDB connections by registering the service provider multiple times with a different prefix passed to the constructor.

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',
    ),
));

That will register 2 services: mongodb.db1 and mongodb.db2.

About

Integrate MongoDB extension with Silex, without Doctrine

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages