verysimple/db-reflector 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

verysimple/db-reflector

Composer 安装命令:

composer require verysimple/db-reflector

包简介

Allows a cross-vendor API to view database schema information

README 文档

README

DB Reflector inspects a database schema and converts it into a simple collection of arrays and objects that can be easily inspected. This includes information about columns, keys and table relationships.

DB Reflector neutralizes vendor-specific information and provides a consistent schema for all supported databases. Some possible uses for this Reflector are for building a generic DB editor or a code generator.

Databases currently supported are MySQL and Postgres. SQLite is being worked on.

Available on packagist.org.

Installation

Install DB Reflector class with composer:

composer require verysimple/db-reflector

For automatic installation, include the project in your composer.json (it is only necessary in require-dev):

{
	"require-dev": {
		"verysimple/db-reflector": ">=1.0.0"
	}
}

Usage

// the reflector object handles the connection
$r = new Reflector('dsn', 'username', 'password');

// The DB name is specified in the DSN
$db = $r->getDB();
	
// enumerate through all of the tables
foreach ($tables as $table) {

	// getPrimaryKey returns an array of 0 or more Column objects
	$key = $table->getPrimaryKey();
	
	// columns is an array of Column objects
	$columns = $table->GetColumns();
	
	// relationships is an array of Relationship objects
	$relationships = $table->getRelationships();

}

Running Unit Tests

First clone repository. For first initial install:

composer install

To refresh autoloader:

composer dumpautoload
  • Run DB setup scripts in /assets/sql
  • create file phpunit_connection.php in root directory
  • see phpunit_bootstrap.php for instructions

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-01-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固