devture/silex-provider-doctrine-mongodb
最新稳定版本:2.0
Composer 安装命令:
composer require devture/silex-provider-doctrine-mongodb
包简介
Silex provider for MongoDB integration via Doctrine
关键字:
README 文档
README
A doctrine/mongodb provider for the Silex micro-framework.
Usage
Registering the provider creates a few services under a given namespace. The provider can be registered multiple times if multiple connections are needed.
Basic Usage
<?php // Register services under the 'mongodb' namespace, with no custom configuration (empty array) $app->register(new \Devture\SilexProvider\DoctrineMongoDB\ServicesProvider('mongodb', [])); // Get a reference to a database on that server connection $app['db'] = function ($app) { return $app['mongodb.connection']->selectDatabase('database_name'); };
Advanced Usage
<?php // See the docs for \MongoClient (http://php.net/MongoClient) for connection string format and options $configuration = [ 'server' => 'mongodb://example.com:27017', 'options' => [ 'connect' => true, 'connectTimeoutMS' => 200, ], ]; $app->register(new \Devture\SilexProvider\DoctrineMongoDB\ServicesProvider('mongodb', $configuration)); $app['db_main'] = function ($app) { return $app['mongodb.connection']->selectDatabase('database_name'); }; $app['db_other'] = function ($app) { return $app['mongodb.connection']->selectDatabase('another_database_name'); };
统计信息
- 总下载量: 223
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-02-23