xatoo / silex2-mongodb-provider
This package is abandoned and no longer maintained.
No replacement package was suggested.
MongoDB service provider for the Silex 2 framework.
0.0.1
2016-06-17 19:37 UTC
Requires
- php: >=5.6
- mongodb/mongodb: ~1.0
- pimple/pimple: ~3.0
- silex/silex: ~2.0
Requires (Dev)
- phpunit/phpunit: ~5.4
- satooshi/php-coveralls: ~1.0
This package is not auto-updated.
Last update: 2019-10-14 14:41:57 UTC
README
MongoDB service provider for the Silex 2 framework. Tested with PHP7 and the MongoDB library.
Requirements
- PHP 5.6 or PHP 7
- PHP MongoDB driver
- MongoDB PHP Library
Installation
Add the required entry for this library to your composer.json
.
{ "require": { "xatoo/silex2-mongodb-provider": "*" } }
and run composer install
(or update
) to download all files.
Usage
Service registration
$app->register(new MongoDBServiceProvider, [
'mongodb.configuration' => [
'default' => [
'server' => "mongodb://localhost:27017",
'options' => ["connect" => true]
]
],
]);
Connections retrieving
$connections = $app['mongodb'];
$defaultConnection = $connections['default'];
Creating a mongo connection via the factory
$mongoFactory = $app['mongodb.factory']; $customConnection = $mongoFactory("mongodb://localhost:27017", ["connect" => true]);
Copyright
- Sander Toonen s.toonen@gmail.com