delboy1978uk/bone-db
最新稳定版本:v1.3.0
Composer 安装命令:
composer require delboy1978uk/bone-db
包简介
Db package for Bone Framework
README 文档
README
PDO Connection package for Bone Framework
installation
bone-db comes pre-installed as part of the core Bone Framework packages. Install the skeleton project https://github.com/delboy1978uk/bonemvc
usage
You should already have a bone-db.php config in your . Here is the Bone Framework Docker development environment settings:
<?php return [ 'db' => [ 'driver' => 'pdo_mysql', 'host' => 'mariadb', 'dbname' => 'awesome', 'user' => 'dbuser', 'password' => '[123456]', ], ];
The two databases and passwords are due to old legacy crap. Will be sorted soon! ;-)
usage
You can inject your PDO connection into any of your classes via your Package registration class:
$pdoConnection = $c->get(PDO::class); // add a use statement too!
convenience interface and trait
You can quickly get a PDO connection getter and setter into your controllers by using Bone\Db\HasDbTrait.
You can also implement Bone\Db\DbProviderInterface and auto initialise it by passing into bone-controller Init class in
the add to container factory method.
reference
Official Manual https://www.php.net/manual/en/book.pdo.php
An awesome detailed book on PDO https://phpdelusions.net/pdo
统计信息
- 总下载量: 2.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-26