myurasov/silex-mongodb-provider

MongoDB provider for Silex applications

v0.1.0 2015-08-20 05:19 UTC

README

Installation with Composer

Add the following line to your composer.json require section:

"myurasov/silex-mongodb-provider": "*"

Or do

composer require myurasov/silex-mongodb-provider

Service Registration

$app->register(new MongoClientProvider(), [config options]);

Then $app['mongodb.mongo_client'] service becomes available.

Confuguration Options

$app['mongodb.mongo_client_options'] = [
    'server' => <connection string>,
    'options' => <connection options>,
    'driver_options' => <driver options>
];

$app['mongodb.db'] = <db name>;

See http://php.net/manual/en/mongoclient.construct.php for more info on parameters above.

License

WTFPL