myurasov / silex-mongodb-provider
MongoDB provider for Silex applications
v0.1.0
2015-08-20 05:19 UTC
Requires
- php: >=5.4
- ext-mongo: ~1.4
- silex/silex: ~1.0
This package is not auto-updated.
Last update: 2025-01-04 20:14:48 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.