jardistools / dbschema
A flexible package for analyzing and managing database schemas (PDO-based) with support for MySQL/MariaDB, PostgreSQL, and SQLite
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
pkg:composer/jardistools/dbschema
Requires
- php: >=8.2
- ext-pdo: *
- jardisport/dbschema: ^1.0
- jardissupport/dotenv: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.0.4
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.11.2
This package is auto-updated.
Last update: 2026-02-25 17:39:43 UTC
README
Part of the Jardis Ecosystem - A modular DDD framework for PHP
A powerful, developer-friendly PHP library for analyzing and managing database schemas. Works seamlessly with MySQL/MariaDB, PostgreSQL, and SQLite through one unified, PDO-based interface. Features automatic driver detection, normalized output structures, and complete DDL/JSON export capabilities.
Features
- Zero Configuration - Just pass a PDO connection, automatic driver detection handles the rest
- Universal Interface - Write once, run on MySQL, MariaDB, PostgreSQL, or SQLite
- Complete Schema Insight - Tables, columns, indexes, foreign keys at your fingertips
- SQL DDL Export - Generate complete database schemas with automatic dependency resolution
- JSON/Array Export - Export schema metadata for documentation and API integration
- Type-Safe - Built with PHP 8.2+, strict types, and PHPStan level 8
Installation
composer require jardistools/dbschema
Quick Start
use JardisTools\DbSchema\DbSchemaReader; use JardisTools\DbSchema\DbSchemaExporter; use PDO; // Create PDO connection - driver auto-detected $pdo = new PDO('mysql:host=localhost;dbname=mydb', 'user', 'pass'); $reader = new DbSchemaReader($pdo); // Read schema information $tables = $reader->tables(); $columns = $reader->columns('users'); $indexes = $reader->indexes('users'); $foreignKeys = $reader->foreignKeys('orders'); // Export schema $exporter = new DbSchemaExporter($reader); $ddl = $exporter->toSql(['users', 'orders']); // SQL DDL $json = $exporter->toJson(['users'], prettyPrint: true); // JSON $array = $exporter->toArray(['users']); // PHP array
Documentation
Full documentation, examples and API reference:
Jardis Ecosystem
This package is part of the Jardis Ecosystem - a collection of modular, high-quality PHP packages designed for Domain-Driven Design.
| Category | Packages |
|---|---|
| Core | Domain, Kernel, Data |
| Adapter | Cache, Logger, Messaging, DbConnection |
| Support | DotEnv, DbQuery, Validation, Factory, ClassVersion, Workflow |
| Tools | Builder, DbSchema |
License
This package is licensed under the PolyForm Noncommercial License 1.0.0.
For commercial use, see COMMERCIAL.md.