PHPackages                             kostasch/laravel-db-toon-schema - 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. kostasch/laravel-db-toon-schema

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

kostasch/laravel-db-toon-schema
===============================

Create a TOON schema of your DB

v0.2.0(1mo ago)03MITPHPPHP ^8.2CI failing

Since Mar 8Pushed 1mo agoCompare

[ Source](https://github.com/kostasxyz/laravel-db-toon-schema)[ Packagist](https://packagist.org/packages/kostasch/laravel-db-toon-schema)[ Docs](https://github.com/kostasxyz/laravel-db-toon-schema)[ RSS](/packages/kostasch-laravel-db-toon-schema/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Laravel DB TOON Schema
======================

[](#laravel-db-toon-schema)

Extract your MySQL, MariaDB, or SQLite schema into JSON and a compressed TOON text format optimized for LLM consumption.

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

[](#installation)

```
composer require kostasch/laravel-db-toon-schema
```

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Laravel `^12.0 || ^13.0`
- MySQL, MariaDB, or SQLite

Usage
-----

[](#usage)

### Artisan Command

[](#artisan-command)

```
# Generate using default connection
php artisan db-toon-schema

# Override connection
php artisan db-toon-schema --connection=reporting

# Override output path (relative to storage/app/private/)
php artisan db-toon-schema --output=my-schema

# Exclude specific tables or columns
php artisan db-toon-schema --exclude-tables=cache --exclude-tables=sessions
php artisan db-toon-schema --exclude-columns=created_at --exclude-columns=updated_at

# Combine options
php artisan db-toon-schema --connection=reporting --output=reporting-schema --exclude-tables=cache
```

Output files are saved to `storage/app/private/db-toon-schema/` by default:

- `schema.json` — full schema with fields and relations
- `schema.toon` — compressed single-line-per-table format

### Programmatic API

[](#programmatic-api)

```
use Kostasch\LaravelDbToonSchema\LaravelDbToonSchema;

$schema = app(LaravelDbToonSchema::class);

$schema->toArray();   // ['schema' => [...], 'relations' => [...]]
$schema->toJson();    // JSON string
$schema->toToon();    // TOON string
$schema->save();      // writes .json + .toon to storage
$schema->save('custom-path');
```

### Facade

[](#facade)

```
use Kostasch\LaravelDbToonSchema\LaravelDbToonSchemaFacade as DbToonSchema;

DbToonSchema::toArray();
DbToonSchema::toToon();
DbToonSchema::save();
```

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --provider="Kostasch\LaravelDbToonSchema\LaravelDbToonSchemaServiceProvider" --tag=config
```

```
// config/laravel-db-toon-schema.php
return [
    'connection' => null,              // null = Laravel default connection
    'excluded_tables' => [],           // tables to always skip
    'excluded_columns' => [],          // columns to always skip
    'output_path' => 'db-toon-schema', // relative to storage/app/private/
];
```

Command options (`--connection`, `--exclude-tables`, `--exclude-columns`, `--output`) override config values when provided.

TOON Format
-----------

[](#toon-format)

Each table is one line: `table_name{field:type field:type}`. Foreign keys append `>ref_table.ref_col`.

```
users{id:u64 name:str email:str}
posts{id:u64 user_id:u64>users.id title:str body:str published_at:dt}

```

### Type Mapping

[](#type-mapping)

SQL TypeTOON`bigint``u64``int``i32``mediumint``i24``smallint``i16``tinyint(1)``b``tinyint``u8``varchar`, `char`, `text`, `longtext``str``datetime`, `timestamp`, `date``dt``time``time``year``year``float``f32``double`, `decimal``f64``json``json``enum('a','b')``enum[a|b]`unknown`unk`Testing
-------

[](#testing)

```
composer test
composer format
```

TODO
----

[](#todo)

- Add real integration tests against MySQL and MariaDB for `MysqlSchemaExtractor`
- Run integration tests in CI with a MySQL/MariaDB matrix
- Keep the current fake-based suite as the default fast test layer
- Gate real DB integration tests behind an env flag for local development

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance89

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~40 days

Total

3

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/921cec8ec7b812de972320e336f3b9aefde89a06adaa7fe5038e5fdcc4306464?d=identicon)[skapator](/maintainers/skapator)

---

Top Contributors

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

---

Tags

kostaschlaravel-db-toon-schema

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kostasch-laravel-db-toon-schema/health.svg)

```
[![Health](https://phpackages.com/badges/kostasch-laravel-db-toon-schema/health.svg)](https://phpackages.com/packages/kostasch-laravel-db-toon-schema)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

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