承接 biaoqianwo/simple-pdo 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

biaoqianwo/simple-pdo

Composer 安装命令:

composer require biaoqianwo/simple-pdo

包简介

A simple Pdo library for micro PHP framework

README 文档

README

A simple Pdo library for micro PHP framework.
It can be done for CRUD. It support write and read are separation.

##How to use

import the package

composer require biaoqianwo/simple-pdo

###Add below code in your bootstrap file (e.g. index.php):

use \Bee\PDO\Model;

Model::config(require_once __DIR__ . '/app/config/db.php');

The config file db.php like:

return [
    'host' => '127.0.0.1',
    'port' => 3306,
    'dbname' => 'mysql_test',
    'options' => null,
    'username' => 'root',
    'password' => '',
];

If your write and read database is different.You can config like:

return [
    'read' => [
        [
            'host' => '127.0.0.1',
            'port' => 3307,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ],
        [
            'host' => '127.0.0.1',
            'port' => 3308,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ],
    'write' => [
        [
            'host' => '127.0.0.1',
            'port' => 3306,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ]
];

Please note that the write and read are existing meanly. If you use write,you must use read. The write and read can be same.
可以读写分离,只是必须读和写的节点必须同时存在,可以相同。

##Add a model file (e.g. Users.php)
The model should and only inherit Bee\PDO\Model. You do not need to code anything more. So it is simple.

namespace App;
use Bee\PDO\Model;
/**
 * Class User
 * @package App
 */
class User extends Model
{
}

And then your controller can use the user model. You can see the demo/UserController.php. e.g.

$sql = "select * from users where id = ?";
$conditions = [$id];
$result = User::first($sql, $conditions);
var_dump($result);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固