hamaryuginh/meekrodb-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

hamaryuginh/meekrodb-bundle

Composer 安装命令:

composer require hamaryuginh/meekrodb-bundle

包简介

A Symfony2 Bundle for MeekroDB

README 文档

README

A symfony2 bundle for MeekroDB.

Installation

Add the bundle to your composer.json

{
    "require": {
        "...",
        "hamaryuginh/meekrodb-bundle": "dev-master"
    }
}

Run composer install

php composer.phar install

Enable the bundle in the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Hamaryuginh\MeekroDbBundle\HamaryuginhMeekroDbBundle(),
    );
}

Configuration

Add configuration to config.yml.

# config.yml

hamaryuginh_meekro_db:
    meekrodb:
        connections:
            my_db_host_1:
                host:     database_host # default value is "localhost"
                port:     6666          # default value is 3306
                encoding: utf8          # default value is utf8
                db_name:  database_name
                user:     database_user
                password: user_password # default value is ""
            my_db_host_2: # you can set multiple host
                ...

Now you're all set, you can now use the bundle as following:

Use

<?php
// In a controller

$dbManager = $this->get('hamaryuginh.meekro_db');
$myDbHost  = $dbManager->get('my_db_host'); // The name of the connection
$account   = $myDbHost->query("SELECT * FROM accounts WHERE username=%s", 'Joe');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-27