定制 devture/silex-provider-doctrine-mongodb 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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');
};

统计信息

  • 总下载量: 227
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固