Download the PHP package beyondcode/laravel-er-diagram-generator without Composer
On this page you can find all versions of the php package beyondcode/laravel-er-diagram-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download beyondcode/laravel-er-diagram-generator
More information about beyondcode/laravel-er-diagram-generator
Files in beyondcode/laravel-er-diagram-generator
Package laravel-er-diagram-generator
Short Description Generate ER diagrams from your Laravel models.
License MIT
Homepage https://github.com/beyondcode/laravel-er-diagram-generator
Informations about the package laravel-er-diagram-generator
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 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:
Or, if you are using Homestead:
To install Graphviz on Windows, download it from the official website.
Installation
You can install the package via composer:
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
:
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.
If you're using Lumen and you want to customize the config, you'll need to copy the config file from the vendor directory:
Generating Diagrams
You can generate entity relation diagrams using the provided artisan command:
This will generate a file called graph.png
.
You can also specify a custom filename:
Or use one of the other output formats, like SVG:
Text Output
If you want to generate a text representation of the ER diagram instead of an image, you can use the --text-output
option:
This will generate a text file with the GraphViz DOT representation of the ER diagram.
Structured Text Output for AI Models
If you want to generate a structured text representation of the ER diagram that is more suitable for AI models, simply specify a filename with a .txt
extension:
This will automatically generate a Markdown file with a structured representation of the entities and their relationships, which can be used as context for AI models.
Output Format
The structured output format looks like this:
This format is particularly useful when providing context to AI models about your database structure.
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.
Testing
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 [email protected] instead of using the issue tracker.
Credits
- Marcel Pociot
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-er-diagram-generator with dependencies
doctrine/dbal Version ^3.3|^4.0
phpdocumentor/graphviz Version ^1.0
nikic/php-parser Version ^4.0|^5.0