PHPackages                             jardisport/dbschema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jardisport/dbschema

ActiveLibrary[Database &amp; ORM](/categories/database)

jardisport/dbschema
===================

Database schema reader and DDL exporter interfaces for multi-database introspection

v1.0.0(2mo ago)0271proprietaryMakefilePHP &gt;=8.2CI passing

Since Mar 17Pushed 2mo agoCompare

[ Source](https://github.com/jardisPort/dbschema)[ Packagist](https://packagist.org/packages/jardisport/dbschema)[ Docs](https://github.com/jardisPort/dbschema)[ RSS](/packages/jardisport-dbschema/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (6)Used By (1)

Jardis DbSchema Port
====================

[](#jardis-dbschema-port)

[![Build Status](https://github.com/jardisPort/dbschema/actions/workflows/ci.yml/badge.svg)](https://github.com/jardisPort/dbschema/actions/workflows/ci.yml/badge.svg)[![License: PolyForm Shield](https://camo.githubusercontent.com/d8fb46c82be4c5312bf3e372ac734dfdf6a8b328e9c2b2856af671adbb0600a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d506f6c79466f726d253230536869656c642d626c75652e737667)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/a68b290dcc313d698dc138a1111aa83eee2f143605449d7e8b5416ea6f88558f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737374242342e737667)](https://www.php.net/)[![PHPStan Level](https://camo.githubusercontent.com/c51bda247654363d3e30bc352674dd761a9557803a14af0226eb411d6dc0006b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d627269676874677265656e2e737667)](phpstan.neon)[![PSR-12](https://camo.githubusercontent.com/34b10db0caa29bacd49bda5c437a8de95385f036f3230b31fa605326e18da22c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d5053522d2d31322d626c75652e737667)](phpcs.xml)

> Part of the **[Jardis Business Platform](https://jardis.io)** — Enterprise-grade PHP components for Domain-Driven Design

Database schema introspection and export contracts. Two interfaces — one reads table structures, columns, indexes, and foreign keys from live databases, the other exports to SQL, JSON, or PHP arrays. Swap implementations without affecting your schema tooling.

---

Interfaces
----------

[](#interfaces)

All interfaces live in the `JardisPort\DbSchema` namespace.

### DbSchemaReaderInterface

[](#dbschemareaderinterface)

Reads schema information from a live database connection.

MethodSignatureDescription`tables``tables(): ?array`Returns all table names in the database`columns``columns(string $container, ?array $fields = null): ?array`Returns column definitions for a table, optionally filtered`indexes``indexes(string $container): ?array`Returns index definitions for a table`foreignKeys``foreignKeys(string $container): ?array`Returns foreign key definitions for a table`fieldType``fieldType(string $fieldType): ?string`Maps a database field type to a PHP type`getDriverName``getDriverName(): string`Returns the database driver name (e.g. `mysql`, `pgsql`)### DbSchemaExporterInterface

[](#dbschemaexporterinterface)

Exports schema data in multiple formats.

MethodSignatureDescription`toSql``toSql(array $tables): string`Exports schema as a SQL DDL script`toJson``toJson(array $tables, bool $prettyPrint = false): string`Exports schema as JSON`toArray``toArray(array $tables): array`Exports schema as a PHP array---

Installation
------------

[](#installation)

```
composer require jardisport/dbschema
```

Usage
-----

[](#usage)

```
use JardisPort\DbSchema\DbSchemaReaderInterface;
use JardisPort\DbSchema\DbSchemaExporterInterface;

class SchemaInspector
{
    public function __construct(
        private readonly DbSchemaReaderInterface $reader,
        private readonly DbSchemaExporterInterface $exporter,
    ) {}

    public function exportAllToJson(): string
    {
        $tables = $this->reader->tables() ?? [];
        return $this->exporter->toJson($tables, prettyPrint: true);
    }
}
```

Implemented by
--------------

[](#implemented-by)

- **[jardistools/dbschema](https://github.com/jardisTools/dbSchema)** — Schema introspection and export for MySQL, PostgreSQL, and SQLite with builder integration

Documentation
-------------

[](#documentation)

Full documentation, guides, and API reference:

**[jardis.io/docs/port/dbschema](https://jardis.io/docs/port/dbschema)**

License
-------

[](#license)

This package is licensed under the [PolyForm Shield License 1.0.0](LICENSE.md). Free for all use except building competing frameworks or developer tooling.

---

**[Jardis](https://jardis.io)** · [Documentation](https://jardis.io/docs) · [Headgent](https://headgent.com)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance88

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

2

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e07a1b668e9e01ee6d1b85de7b3be1c2513f68aae9494b2011d1592104d5daa0?d=identicon)[jardis](/maintainers/jardis)

---

Top Contributors

[![Headgent](https://avatars.githubusercontent.com/u/245725954?v=4)](https://github.com/Headgent "Headgent (1 commits)")

---

Tags

interfacesschemadatabasedddHeadgentJardisPort

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jardisport-dbschema/health.svg)

```
[![Health](https://phpackages.com/badges/jardisport-dbschema/health.svg)](https://phpackages.com/packages/jardisport-dbschema)
```

###  Alternatives

[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41234.1k4](/packages/aura-sqlschema)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)[concretecms/doctrine-xml

Define database structure via XML using Doctrine data types

11100.8k2](/packages/concretecms-doctrine-xml)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
