定制 herrera-io/silex-pdo 二次开发

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

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

herrera-io/silex-pdo

最新稳定版本:1.2.1

Composer 安装命令:

composer require herrera-io/silex-pdo

包简介

A simple PDO service provider.

README 文档

README

Build Status

A simple PDO service provider.

Summary

A stupid simple PDO service provider. I cannot get any more clear than this.

Installation

Add it to your list of Composer dependencies:

$ composer require "herrera-io/silex-pdo=1.*"

Usage

use Herrera\Pdo\PdoServiceProvider;
use Silex\Application;

$app = new Application();
$app->register(
    new PdoServiceProvider(),
    array(
        'pdo.dsn' => 'pdo_mysql:dbname=test;host=127.0.0.1',
        'pdo.username' => 'username', // optional
        'pdo.password' => 'password', // optional
        'pdo.options' => array( // optional
            PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
        )
    )
);

$pdo = $app['pdo'];

You can also use the PdoTrait to add a prepare method to your application:

use Herrera\Pdo\PdoTrait;
use Silex\Application;

class MyApp extends Application
{
    use PdoTrait;
}

You will still need to register the service provider.

If debugging is enabled and Monolog is available, a logging version of PDO will be used to log queries and their execution time.

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-31