PHPackages                             bauerdot/laravel-dbml - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bauerdot/laravel-dbml

ActivePackage[Utility &amp; Helpers](/categories/utility)

bauerdot/laravel-dbml
=====================

Kacher is Laravel DB to DBML (dbdiagram.io/dbdocs.io)

v0.0.2(1y ago)11.7k↓50%MITPHPPHP ^8.1

Since May 14Pushed 1y agoCompare

[ Source](https://github.com/bauerDOTuzh/laravel-dbml)[ Packagist](https://packagist.org/packages/bauerdot/laravel-dbml)[ RSS](/packages/bauerdot-laravel-dbml/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

CURRENTLY PUBLISHED AS TEST PACKAGE!
====================================

[](#currently-published-as-test-package)

Laravel DBML
============

[](#laravel-dbml)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/f26902186b3568fcaea33f9a08977d241a8af5a7cdc1b7c8c1a50594bc06c6a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261756572646f742f6c61726176656c2d64626d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bauerdot/laravel-dbml)

Install
-------

[](#install)

`composer require bauerdot/laravel-dbml`

Usage
-----

[](#usage)

- For listing all tables in database: `php artisan dbml:list` (custom type --custom)
- For Parse from DB to DBML: `php artisan dbml:parse` (see options below)

### Available Options

[](#available-options)

```
--dbdocs           Generate output for DBDocs
--custom           Use custom type mapping
--include-system   Include Laravel system tables (migrations, cache, etc.)
--no-ignore        Don't ignore any tables, include everything
--ignore-preset=   Specify ignore presets to use (system,spatie-permissions,telescope)
--config=          Path to external configuration file
--only=          Only parse specific tables (comma-separated list or multiple values)

```

Table Filtering and Ignore Presets
----------------------------------

[](#table-filtering-and-ignore-presets)

### System Tables

[](#system-tables)

By default, Laravel system tables are ignored. You can include them with the `--include-system` flag:

```
php artisan dbml:parse --include-system
```

### Ignore Presets

[](#ignore-presets)

The package comes with predefined groups of tables (presets) that can be ignored:

- **system**: Laravel's core tables (migrations, jobs, cache, etc.)
- **spatie-permissions**: Tables from the Spatie Laravel-Permission package
- **telescope**: Laravel Telescope tables

You can specify which presets to use:

```
# Use only system and telescope presets
php artisan dbml:parse --ignore-preset=system,telescope

# Use only spatie-permissions preset
php artisan dbml:parse --ignore-preset=spatie-permissions
```

### Include All Tables

[](#include-all-tables)

If you want to include all tables with no filtering, use the `--no-ignore` flag:

```
php artisan dbml:parse --no-ignore
```

Configuration File
------------------

[](#configuration-file)

You can specify a custom configuration file with the `--config` option:

```
php artisan dbml:parse --config=path/to/config.json
```

The config file can be in JSON, PHP, or YAML format and supports the following options:

```
{
    "system_tables": ["migrations", "failed_jobs", "password_resets"],
    "ignored_tables": ["audit_logs", "log_*"],
    "document_casts": true,
    "document_cast_types": ["json", "array", "object", "collection"],
    "document_spatie_data": true,
    "inline_schema": true,
    "spatie_data_namespace": "App\\ValueObjects",
    "only_tables": ["users", "brokers", "client_*"],
    "models_dir": "app/Models"
}
```

### Available Configuration Options

[](#available-configuration-options)

OptionTypeDefaultDescription`ignore_by_default`booleantrueWhether to ignore tables by default`ignore_presets`arraysystem, spatie-permissions, telescopePredefined groups of tables to ignore`active_presets`array\['system'\]Presets that are active by default`ignored_tables`array\[\]Additional tables to always ignore`document_casts`booleantrueWhether to document Laravel cast attributes`document_cast_types`arrayjson, array, etc.Which cast types to document`document_spatie_data`booleantrueWhether to document Spatie Data objects`inline_schema`booleantruePut schema in column-level notes instead of table notes`spatie_data_namespace`stringApp\\ValueObjectsNamespace for your Spatie Data objects`only_tables`array\[\]Only process these tables (supports wildcards)`models_dir`stringapp/ModelsDirectory where your Laravel models are located### Publishing the Configuration

[](#publishing-the-configuration)

You can publish the package configuration file with:

```
php artisan vendor:publish --provider="Bauerdot\\LaravelDbml\\LaravelDbmlServiceProvider" --tag="config"
```

Parsing Specific Tables Only
----------------------------

[](#parsing-specific-tables-only)

You can use the `--only` option to specify which tables should be included in the DBML output:

```
# Parse only the 'users' and 'posts' tables
php artisan dbml:parse --only=users,posts

# Parse tables that match a pattern
php artisan dbml:parse --only="user_*"

# You can also specify multiple --only options
php artisan dbml:parse --only=users --only=posts
```

Column-Level Schema Documentation
---------------------------------

[](#column-level-schema-documentation)

This package adds schema information directly to column definitions, making it easier to understand complex data structures:

```
Table brokers {
    id int [pk, increment]
    settings json [null, note: 'Schema: {
      "theme": "string",
      "notifications": {
        "email": "boolean",
        "sms": "boolean"
      }
    }']
    // other columns...
}

```

Laravel Model Cast Documentation
--------------------------------

[](#laravel-model-cast-documentation)

This package can automatically detect Laravel model cast attributes and document their structure in the DBML output. This is especially useful for JSON columns where the structure is defined in the model.

To document the JSON structure in your models, add a `@json-structure` tag to your property or accessor method:

```
/**
 * @json-structure {
 *   "name": "string",
 *   "address": {
 *     "street": "string",
 *     "city": "string"
 *   }
 * }
 */
protected $casts = [
    'settings' => 'json',
];
```

Spatie Data Object Support
--------------------------

[](#spatie-data-object-support)

The package can analyze Spatie Data objects used in Laravel model casts and document their structure. For example, with a model like this:

```
class Broker extends Model
{
    protected $casts = [
        'permanent_address' => AddressValueObject::class,
        'contact_address' => AddressValueObject::class
    ];
}
```

And a Spatie Data object like this:

```
class AddressValueObject extends Data
{
    public function __construct(
        public readonly ?string $city,
        public readonly ?string $street,
        public readonly ?string $country,
        public readonly ?string $zip,
        public readonly ?string $houseNumber,
        public readonly ?string $district = null,
        public readonly ?string $referenceNumber = null
    ) {}
}
```

The DBML output will include the structure:

```
permanent_address json [null, note: 'Schema: Spatie Data Object (AddressValueObject): {
  city: ?string (nullable)
  street: ?string (nullable)
  country: ?string (nullable)
  zip: ?string (nullable)
  houseNumber: ?string (nullable)
  district: ?string (nullable) = null
  referenceNumber: ?string (nullable) = null
}']

```

Customizable Type
-----------------

[](#customizable-type)

- Store file in /storage/app/custom\_type.json
- Example
    - { "type": "target\_type" }

Credits
-------

[](#credits)

- [Arsanandha Aphisitworachorch](https://github.com/aphisitworachorch) - Original author
- [bauerdot](https://github.com/bauerdotuzh) - Fork maintainer
- [All Contributors](https://github.com/bauerdotuzh/laravel-dbml/contributors)

Security
--------

[](#security)

If you discover any security-related issues, please open an issue or pull request.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](/LICENSE.md) for more information.

For developers
--------------

[](#for-developers)

- you need to use the package in you project for developemtn you need already existing project and then add this to composer .json

```
 "repositories": [
        {
            "type": "path",
            "url": "../laravel-dbml",
            "options": {
                "symlink": true
            }
        }
    ]
```

and then run

```
composer require bauerdot/laravel-dbml:@dev
```

- since this package has no laravel instalation you need therefore to have it

- no need for autodiscovery this package has it already inside

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance49

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70.6% 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 ~0 days

Total

2

Last Release

370d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ed5cf078b75e518346f8c1ef66e707252e17a5495c9678c29d800e2216f53cc?d=identicon)[bauerdot](/maintainers/bauerdot)

---

Top Contributors

[![aphisitworachorch](https://avatars.githubusercontent.com/u/10544462?v=4)](https://github.com/aphisitworachorch "aphisitworachorch (24 commits)")[![areichardt-apo](https://avatars.githubusercontent.com/u/110381142?v=4)](https://github.com/areichardt-apo "areichardt-apo (5 commits)")[![bauerDOTuzh](https://avatars.githubusercontent.com/u/91192620?v=4)](https://github.com/bauerDOTuzh "bauerDOTuzh (3 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![LucaA031](https://avatars.githubusercontent.com/u/107250556?v=4)](https://github.com/LucaA031 "LucaA031 (1 commits)")

---

Tags

laravel

### Embed Badge

![Health badge](/badges/bauerdot-laravel-dbml/health.svg)

```
[![Health](https://phpackages.com/badges/bauerdot-laravel-dbml/health.svg)](https://phpackages.com/packages/bauerdot-laravel-dbml)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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