PHPackages                             majdghithann/laravel-er-diagram-generator - 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. majdghithann/laravel-er-diagram-generator

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

majdghithann/laravel-er-diagram-generator
=========================================

Generate ER diagrams from your Laravel models.

01PHP

Since Nov 27Pushed 1y agoCompare

[ Source](https://github.com/majdcodes/laravel-er-diagram-generator)[ Packagist](https://packagist.org/packages/majdghithann/laravel-er-diagram-generator)[ RSS](/packages/majdghithann-laravel-er-diagram-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel ER Diagram Generator
============================

[](#laravel-er-diagram-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b4131b70cd90a610a566da7c5c3727367445a3bcb5db95e9ab5fc893b17d3d55/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265796f6e64636f64652f6c61726176656c2d65722d6469616772616d2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator)[![Total Downloads](https://camo.githubusercontent.com/e354c5896a40b528a61489a83de2e877f3bd941f49ca89993b18ecf276d51c4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265796f6e64636f64652f6c61726176656c2d65722d6469616772616d2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator)

This package lets you generate entity relation diagrams by inspecting the relationships defined in your model files. It is highly customizable. Behind the scenes, it uses [GraphViz](https://www.graphviz.org) to generate the graph.

> If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.

Prerequisites
-------------

[](#prerequisites)

The minimum required PHP version is 7.1.0.

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

[](#requirements)

This package requires the `graphviz` tool.

You can install Graphviz on MacOS via homebrew:

```
brew install graphviz
```

Or, if you are using Homestead:

```
sudo apt-get install graphviz
```

To install Graphviz on Windows, download it from the [official website](https://graphviz.gitlab.io/_pages/Download/Download_windows.html).

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

[](#installation)

You can install the package via composer:

```
composer require beyondcode/laravel-er-diagram-generator --dev
```

If you are using Laravel 5.5+, the package will automatically register the service provider for you.

If you are using Lumen, you will need to add the following to `bootstrap\app.php`:

```
# Register Service Providers
$app->register(BeyondCode\ErdGenerator\ErdGeneratorServiceProvider::class);
```

Usage
-----

[](#usage)

By default, the package will automatically detect all models in your `app/Models` directory that extend the Eloquent Model class. If you would like you explicitly define where your models are located, you can publish the configuration file using the following command.

```
php artisan vendor:publish --provider=BeyondCode\\ErdGenerator\\ErdGeneratorServiceProvider
```

If you're using Lumen and you want to customize the config, you'll need to copy the config file from the vendor directory:

```
cp ./vendor/beyondcode/laravel-er-diagram-generator/config/config.php config/erd-generator.php
```

Generating Diagrams
-------------------

[](#generating-diagrams)

You can generate entity relation diagrams using the provided artisan command:

```
php artisan generate:erd
```

This will generate a file called `graph.png`.

You can also specify a custom filename:

```
php artisan generate:erd output.png
```

Or use one of the other [output formats](https://www.graphviz.org/doc/info/output.html), like SVG:

```
php artisan generate:erd output.svg --format=svg
```

Customization
-------------

[](#customization)

Please take a look at the published `erd-generator.php` configuration file for all available customization options.

Examples
--------

[](#examples)

Here are some examples taken from the [Laravel.io](https://laravel.io) codebase.

[![Using Database Schema](https://camo.githubusercontent.com/f031f555abbcc3e745f74b9a7f77e1ea6972103fe6ac52f838c40cbdcb6c5d1a/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6572642d67656e657261746f722f736368656d612e706e67)](https://camo.githubusercontent.com/f031f555abbcc3e745f74b9a7f77e1ea6972103fe6ac52f838c40cbdcb6c5d1a/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6572642d67656e657261746f722f736368656d612e706e67)

[![Customized](https://camo.githubusercontent.com/dbbc243b54022f30a5eebd726e513c55cdd721f3ec8fcd193d9fb6f94851de56/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6572642d67656e657261746f722f637573746f6d697a65642e706e67)](https://camo.githubusercontent.com/dbbc243b54022f30a5eebd726e513c55cdd721f3ec8fcd193d9fb6f94851de56/68747470733a2f2f6265796f6e64636f2e64652f6769746875622f6572642d67656e657261746f722f637573746f6d697a65642e706e67)

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3986150244a71187e6de0ce79039cabb6d30894412a319753e30d55e655b731b?d=identicon)[majdcodes](/maintainers/majdcodes)

---

Top Contributors

[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (31 commits)")[![mechelon](https://avatars.githubusercontent.com/u/26432041?v=4)](https://github.com/mechelon "mechelon (9 commits)")[![majdcodes](https://avatars.githubusercontent.com/u/117023101?v=4)](https://github.com/majdcodes "majdcodes (5 commits)")[![diogogomeswww](https://avatars.githubusercontent.com/u/11543163?v=4)](https://github.com/diogogomeswww "diogogomeswww (5 commits)")[![daniel-werner](https://avatars.githubusercontent.com/u/38726367?v=4)](https://github.com/daniel-werner "daniel-werner (2 commits)")[![NiclasvanEyk](https://avatars.githubusercontent.com/u/10284694?v=4)](https://github.com/NiclasvanEyk "NiclasvanEyk (2 commits)")[![ThibaudDauce](https://avatars.githubusercontent.com/u/1770543?v=4)](https://github.com/ThibaudDauce "ThibaudDauce (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![henryavila](https://avatars.githubusercontent.com/u/8429941?v=4)](https://github.com/henryavila "henryavila (1 commits)")[![eiko03](https://avatars.githubusercontent.com/u/23137164?v=4)](https://github.com/eiko03 "eiko03 (1 commits)")[![drbyte](https://avatars.githubusercontent.com/u/404472?v=4)](https://github.com/drbyte "drbyte (1 commits)")[![Yahav](https://avatars.githubusercontent.com/u/113236?v=4)](https://github.com/Yahav "Yahav (1 commits)")[![orkhanahmadov](https://avatars.githubusercontent.com/u/7041590?v=4)](https://github.com/orkhanahmadov "orkhanahmadov (1 commits)")[![pascalbaljet](https://avatars.githubusercontent.com/u/8403149?v=4)](https://github.com/pascalbaljet "pascalbaljet (1 commits)")[![rdarcy1](https://avatars.githubusercontent.com/u/15962421?v=4)](https://github.com/rdarcy1 "rdarcy1 (1 commits)")[![simondavies](https://avatars.githubusercontent.com/u/689184?v=4)](https://github.com/simondavies "simondavies (1 commits)")[![iforwms](https://avatars.githubusercontent.com/u/10304616?v=4)](https://github.com/iforwms "iforwms (1 commits)")[![joe-pritchard](https://avatars.githubusercontent.com/u/25373032?v=4)](https://github.com/joe-pritchard "joe-pritchard (1 commits)")

### Embed Badge

![Health badge](/badges/majdghithann-laravel-er-diagram-generator/health.svg)

```
[![Health](https://phpackages.com/badges/majdghithann-laravel-er-diagram-generator/health.svg)](https://phpackages.com/packages/majdghithann-laravel-er-diagram-generator)
```

###  Alternatives

[appstract/laravel-opcache

PHP OPcache Artisan commands for Laravel.

1.4k4.9M7](/packages/appstract-laravel-opcache)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[cmixin/business-time

Carbon mixin to handle business days and opening hours

3171.3M1](/packages/cmixin-business-time)[jaocero/radio-deck

Turn filament default radio button into a selectable card with icons, title and description.

83281.2k5](/packages/jaocero-radio-deck)[am-impact/amforms

Forms plugin for Craft

1202.6k](/packages/am-impact-amforms)

PHPackages © 2026

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