承接 depage/db 相关项目开发

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

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

depage/db

Composer 安装命令:

composer require depage/db

包简介

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

README 文档

README

PDO Wrapper

A small wrapper around the pdo object which allows late/on demand initialization of the database connection.

Schema

The Schema class imports or updates SQL database schemata. Schemata are described by common SQL files with update instructions in comments. SQL files can also be templates to allow for prefixing/replacement of table identifiers.

Instruction tags

  • @@version
    • mandatory, labels the following code with a version identifier
  • @@tablename
    • mandatory, declares database tablename to be updated
    • marks table identifier for replacement function
  • @@connection
    • marks table identifiers for replacement function

Example

SQL schema file (schema.sql)

# @tablename example
# @version 0.1
CREATE TABLE example (
    uid int(10) unsigned NOT NULL DEFAULT '0',
    pid int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

# @version 0.2
ALTER TABLE example
ADD COLUMN did int(10) unsigned NOT NULL DEFAULT '0' AFTER pid;

Import/update in PHP

$schema = new Schema($pdo);
$schema->setReplace(
    function ($tableName) {
        return 'prefix_' . $tableName;
    }
);
$schema->loadFile('schema.sql');

License (dual)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固