laravel-er-diagram-generator

Generate entity relation diagrams from your Laravel model files.

Github星跟踪图

Laravel ER Diagram Generator

Latest Version on Packagist
Build Status
Quality Score
Total Downloads

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.

Prerequisites

The minimum required PHP version is 7.1.0.

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.

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

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\\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

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, like SVG:

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

Customization

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

Examples

Here are some examples taken from the Laravel.io codebase.

Using Database Schema

Customized

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.

主要指标

概览
名称与所有者beyondcode/laravel-er-diagram-generator
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2018-07-03 11:19:19
推送于2025-03-11 12:10:56
最后一次提交2024-12-06 17:59:06
发布数17
最新版本名称4.0.0 (发布于 )
第一版名称0.1.0 (发布于 )
用户参与
星数2k
关注者数33
派生数199
提交数75
已启用问题?
问题数76
打开的问题数15
拉请求数28
打开的拉请求数4
关闭的拉请求数11
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?