PHPackages                             bambamboole/laravel-mermaid-erd - 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. bambamboole/laravel-mermaid-erd

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

bambamboole/laravel-mermaid-erd
===============================

This is my package laravel-mermaid-erd

0.3.5(1mo ago)31.7k↓61.4%2[2 PRs](https://github.com/bambamboole/laravel-mermaid-erd/pulls)MITPHPPHP ^8.3CI passing

Since Sep 2Pushed 1w ago1 watchersCompare

[ Source](https://github.com/bambamboole/laravel-mermaid-erd)[ Packagist](https://packagist.org/packages/bambamboole/laravel-mermaid-erd)[ Docs](https://github.com/bambamboole/laravel-mermaid-erd)[ GitHub Sponsors](https://github.com/bambamboole)[ RSS](/packages/bambamboole-laravel-mermaid-erd/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (9)Dependencies (26)Versions (17)Used By (0)

Laravel Mermaid ERD
===================

[](#laravel-mermaid-erd)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4750f9d32f05df694f1a41441b29c73126d51587c29776da3c59cf15048538b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62616d62616d626f6f6c652f6c61726176656c2d6d65726d6169642d6572642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/laravel-mermaid-erd)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d1d1fc091212a2e471d1cdff70fd1350f3da05d7dd309a4c00a8a4e9cce93976/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62616d62616d626f6f6c652f6c61726176656c2d6d65726d6169642d6572642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/bambamboole/laravel-mermaid-erd/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/743fec8c0a0e1e2a54db7ba8ca206910ab6520fea603b27bd12fd47434aa5a15/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62616d62616d626f6f6c652f6c61726176656c2d6d65726d6169642d6572642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/bambamboole/laravel-mermaid-erd/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c5fc115609371915d422907743152eef9f4ca705ce5d8333d6f4e3086ced3d92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62616d62616d626f6f6c652f6c61726176656c2d6d65726d6169642d6572642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/laravel-mermaid-erd)

Generate Entity-Relationship Diagrams (ERDs) from your Laravel database schema using [Mermaid.js](https://mermaid.js.org/). Visualize tables, columns, and foreign key relationships with a single Artisan command.

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

[](#installation)

```
composer require bambamboole/laravel-mermaid-erd
```

Optionally publish the config file to customize which tables are ignored:

```
php artisan vendor:publish --tag="laravel-mermaid-erd-config"
```

Usage
-----

[](#usage)

```
php artisan generate:mermaid-erd
```

When run without options, the command will interactively ask how you want to output the diagram.

### Output modes

[](#output-modes)

#### Print to stdout

[](#print-to-stdout)

```
php artisan generate:mermaid-erd --output=stdout
```

Prints the Mermaid ERD diagram directly to the console.

#### Write to a file

[](#write-to-a-file)

```
php artisan generate:mermaid-erd --output=file --path=README.md
```

Writes the diagram to the specified file (defaults to `README.md`). The file output uses `\` / `` comment tags:

- **File has tags**: replaces content between the tags
- **File exists without tags**: appends an `## ERD` section with the diagram
- **File doesn't exist**: creates it with the diagram

Add these tags where you want the diagram to appear:

```

```

### Options

[](#options)

#### `--connection`

[](#--connection)

Use a specific database connection instead of the default:

```
php artisan generate:mermaid-erd --output=stdout --connection=mysql
```

#### `--tables`

[](#--tables)

Only include specific tables (comma-separated):

```
php artisan generate:mermaid-erd --output=stdout --tables=users,posts,comments
```

### Configuration

[](#configuration)

The config file allows you to ignore specific tables:

```
return [
    'schema' => null,

    'ignore_tables' => [
        'migrations',
        'failed_jobs',
        'sessions',
        // ...
    ],
];
```

By default, MySQL connections are scoped to the active database name so tables from other visible databases are not included in the diagram. Set `schema` if you want to inspect a specific schema/database explicitly.

### Smart relationship detection

[](#smart-relationship-detection)

The generator automatically detects pivot tables (tables with exactly 2 foreign keys and only `id`/timestamp columns) and renders them as many-to-many relationships instead of separate entities. Foreign key columns with unique indexes are rendered as one-to-one relationships.

ERD
---

[](#erd)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [bambamboole](https://github.com/bambamboole)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.9% 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 ~76 days

Recently: every ~18 days

Total

9

Last Release

56d ago

PHP version history (2 changes)0.1.0PHP ^8.1

0.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/547137a6d80cad01ed1dd065b1c6af329d9a23a4134a895cff01e078cc155500?d=identicon)[bambamboole](/maintainers/bambamboole)

---

Top Contributors

[![bambamboole](https://avatars.githubusercontent.com/u/8823695?v=4)](https://github.com/bambamboole "bambamboole (35 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![ChatttyGPT](https://avatars.githubusercontent.com/u/171073050?v=4)](https://github.com/ChatttyGPT "ChatttyGPT (1 commits)")

---

Tags

laravelbambamboolelaravel-mermaid-erd

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bambamboole-laravel-mermaid-erd/health.svg)

```
[![Health](https://phpackages.com/badges/bambamboole-laravel-mermaid-erd/health.svg)](https://phpackages.com/packages/bambamboole-laravel-mermaid-erd)
```

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.0k2](/packages/wnx-laravel-backup-restore)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[nativephp/desktop

NativePHP for Desktop

39742.4k8](/packages/nativephp-desktop)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)

PHPackages © 2026

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