承接 jardistools/dbschema 相关项目开发

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

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

jardistools/dbschema

最新稳定版本:v1.0.0

Composer 安装命令:

composer require jardistools/dbschema

包简介

Database schema introspection and DDL export for MySQL, MariaDB, PostgreSQL, and SQLite

README 文档

README

Build Status License: MIT PHP Version PHPStan Level PSR-12 Coverage

Part of the Jardis Business Platform — Enterprise-grade PHP components for Domain-Driven Design

Database schema introspection and DDL export. Reads table structures, columns, indexes, and foreign keys from live databases via PDO. Exports to SQL (CREATE TABLE), JSON, or PHP arrays. Dialect-aware for MySQL, MariaDB, PostgreSQL, and SQLite.

Features

  • Schema Introspection — reads tables, columns, indexes, and foreign keys from a live database
  • DDL Export — generates CREATE TABLE SQL scripts with dialect-correct syntax
  • JSON Export — structured JSON output suitable for storage, diffing, or feeding the Jardis Builder
  • Array Export — PHP array representation for programmatic processing
  • Multi-Database — MySQL, MariaDB, PostgreSQL, and SQLite via automatic PDO driver detection
  • Abstract Type MappingfieldType() normalises driver-specific column types to portable abstract types
  • Field Type Normalization — consistent column metadata regardless of database vendor

Installation

composer require jardistools/dbschema

Quick Start

use JardisTools\DbSchema\DbSchemaReader;
use JardisTools\DbSchema\DbSchemaExporter;

$pdo = new PDO('mysql:host=localhost;dbname=shop', 'user', 'pass');

$reader   = new DbSchemaReader($pdo);
$exporter = new DbSchemaExporter($reader);

// List all tables
$tables = $reader->tables();

// Export schema as JSON (suitable for Jardis Builder input)
$json = $exporter->toJson($tables, prettyPrint: true);
file_put_contents('schema.json', $json);

Advanced Usage

use JardisTools\DbSchema\DbSchemaReader;
use JardisTools\DbSchema\DbSchemaExporter;

$pdo    = new PDO('pgsql:host=localhost;dbname=shop', 'user', 'pass');
$reader = new DbSchemaReader($pdo);

// Inspect a single table
$columns    = $reader->columns('orders');
$indexes    = $reader->indexes('orders');
$foreignKeys = $reader->foreignKeys('orders');

// Translate a driver-specific type to a portable abstract type
$abstractType = $reader->fieldType('character varying'); // → 'string'

// Export selected tables as SQL DDL
$exporter = new DbSchemaExporter($reader);
$ddl = $exporter->toSql(['orders', 'order_lines', 'customers']);
echo $ddl;
// CREATE TABLE "orders" ( ... );
// CREATE TABLE "order_lines" ( ... );

// Export as PHP array for custom processing
$schema = $exporter->toArray(['orders', 'order_lines']);
// [
//   'version'   => '1.0',
//   'generated' => '2025-01-16 10:30:00',
//   'tables'    => ['orders' => ['columns' => [...], 'indexes' => [...], 'foreignKeys' => [...]]]
// ]

// Feed directly into the Jardis Builder
use JardisTools\Builder\Config\DatabaseSchema;
$databaseSchema = DatabaseSchema::fromArray($schema);

Documentation

Full documentation, guides, and API reference:

docs.jardis.io/en/tools/dbschema

License

This package is licensed under the MIT License.

Jardis · Documentation · Headgent

KI-gestützte Entwicklung

Dieses Package liefert einen Skill für Claude Code, Cursor, Continue und Aider mit. Installation im Konsumentenprojekt:

composer require --dev jardis/dev-skills

Mehr Details: https://docs.jardis.io/skills

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固