定制 delboy1978uk/bone-db 二次开发

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

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

delboy1978uk/bone-db

最新稳定版本:v1.3.0

Composer 安装命令:

composer require delboy1978uk/bone-db

包简介

Db package for Bone Framework

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License
Build Status Code Coverage Scrutinizer Code Quality

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-26