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 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 video course.
The minimum required PHP version is 7.1.0.
This package requires the graphviz tool.
You can install Graphviz on MacOS via homebrew:
brew install graphvizOr, if you are using Homestead:
sudo apt-get install graphvizTo install Graphviz on Windows, download it from the official website.
You can install the package via composer:
composer require beyondcode/laravel-er-diagram-generator --devIf 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);By default, the package will automatically detect all models in your app 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\\ErdGeneratorServiceProviderIf 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.phpYou can generate entity relation diagrams using the provided artisan command:
php artisan generate:erdThis will generate a file called graph.png.
You can also specify a custom filename:
php artisan generate:erd output.pngOr use one of the other output formats, like SVG:
php artisan generate:erd output.svg --format=svgPlease take a look at the published erd-generator.php configuration file for all available customization options.
Here are some examples taken from the Laravel.io codebase.
composer testPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.

