Skip to content

Sander-Toonen/silex2-mongodb-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silex 2 MongoDb Provider

Build Status Coverage Status Dependency Status StyleCI SensioLabsInsight Latest Stable Version Total Downloads License

MongoDB service provider for the Silex 2 framework. Tested with PHP7 and the MongoDB library.

Requirements

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

About

MongoDB service provider for the Silex 2 framework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages