php-extended/php-db-schema-mysql
最新稳定版本:9.7.10
Composer 安装命令:
composer require php-extended/php-db-schema-mysql
包简介
A library to abstract the mysql database schema rules
关键字:
README 文档
README
A library to abstract the mysql database schema rules
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-db-schema-mysql ^9
Basic Usage
This library can generate CREATE DATABASE statements.
use PhpExtended\DbSchema\MysqlTableFactory;
use PhpExtended\DbSchema\MysqlDialect;
use PhpExtended\DbSchema\MysqlTypeNumber;
use PhpExtended\DbSchema\MysqlTypeString;
$factory = new MysqlTableFactory();
$dialect = new MysqlDialect();
$factory->setName('<tableName>');
// <tableColumnId> INT(11) NOT NULL AUTO_INCREMENT COMMENT 'The primary key'
$factory->addColumn('<tableColumnId>', MysqlTypeNumber::INT(), 11, null, null, false, true, 'The primary key');
// <nameColumn> VARCHAR(255) NOT NULL COMMENT 'The name of the <xxx>'
$factory->addColumn('<nameColumn>', MysqlTypeString::VARCHAR(), 255, null, null, false, false, 'The name of the <xxx>');
$factory->addsToPrimaryKey('<tableColumnId>');
$sql = $dialect->showCreateTable($factory->getTable()); // CREATE TABLE ...
License
MIT (See license file).
统计信息
- 总下载量: 6.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-20