cekurte/doctrinebundle
Composer 安装命令:
composer require cekurte/doctrinebundle
包简介
A extension of features of the doctrine library
README 文档
README
- An extension to Doctrine DBAL that can be used to switch between database connections in runtime with Symfony 2, contribute with this project!
If you liked of this library, give me a star =).
Installation
- The package is available on Packagist.
- The source files is PSR-2 compatible.
- Autoloading is PSR-4 compatible.
composer require cekurte/doctrinebundle
After, register the bundle in your AppKernel like this:
// app/AppKernel.php // ... public function registerBundles() { $bundles = array( // ... new Cekurte\DoctrineBundle\CekurteDoctrineBundle(), // ... ); // ... return $bundles; }
Documentation
Well, firstly you must configure a doctrine database connection. So, add this in your config file.
# app/config/config.yml # ... doctrine: dbal: default_connection: dynamic connections: dynamic: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: UTF8 wrapper_class: "Cekurte\DoctrineBundle\DBAL\ConnectionWrapper"
After that, when you need change the database connection you can retrieve a service id named doctrine.dbal.dynamic_connection and call the method forceSwitch, see the example below.
<?php namespace YourNamespace\YourBundleBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class YourController extends Controller { public function indexAction() { // ... // Change the current database connection... $this ->get('doctrine.dbal.dynamic_connection') ->forceSwitch( $dbHost, $dbName, $dbUser, $dbPassword, $dbOptions ) ; } }
Contributing
- Give me a star =)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Make your changes
- Run the tests, adding new ones for your own code if necessary (
vendor/bin/phpunit) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
cekurte/doctrinebundle 适用场景与选型建议
cekurte/doctrinebundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 701 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「doctrine」 「querystring」 「multitenancy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cekurte/doctrinebundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cekurte/doctrinebundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cekurte/doctrinebundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Query String manipulation library. PHP 7.1+. No dependency, immutable, PSR-7 compliant.
User actions logger dependency for Laravel Enso
Make pimcore migration simple
A simple, single database multi-tenancy solution for Laravel 5.2+
User actions logger dependency for Laravel Enso
Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction
统计信息
- 总下载量: 701
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-10