herrera-io/silex-pdo
最新稳定版本:1.2.1
Composer 安装命令:
composer require herrera-io/silex-pdo
包简介
A simple PDO service provider.
关键字:
README 文档
README
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
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-05-31