|
| 1 | +# Laravel ER Diagram Generator |
| 2 | + |
| 3 | +[](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator) |
| 4 | +[](https://travis-ci.org/beyondcode/laravel-er-diagram-generator) |
| 5 | +[](https://scrutinizer-ci.com/g/beyondcode/laravel-er-diagram-generator) |
| 6 | +[](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator) |
| 7 | + |
| 8 | +This package lets you generate entity relation diagrams by inspecting the relationships defined in your model files. |
| 9 | +It is highly customizable. |
| 10 | +Behind the scenes, it uses [GraphViz](https://www.graphviz.org) to generate the graph. |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +This package requires the `graphviz` tool. |
| 15 | + |
| 16 | +You can install Graphviz on MacOS via homebrew: |
| 17 | + |
| 18 | +```bash |
| 19 | +brew install graphviz |
| 20 | +``` |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +You can install the package via composer: |
| 25 | + |
| 26 | +```bash |
| 27 | +composer require beyondcode/laravel-er-diagram-generator --dev |
| 28 | +``` |
| 29 | + |
| 30 | +If you are using Laravel 5.5+, the package will automatically register the service provider for you. |
| 31 | + |
| 32 | +## Usage |
| 33 | + |
| 34 | +Once the package is installed, publish the configuration file using |
| 35 | + |
| 36 | +```bash |
| 37 | +php artisan vendor:publish --proivder=BeyondCode\\ErdGenerator\\ErdGeneratorServiceProvider |
| 38 | +``` |
| 39 | + |
| 40 | +Open the configuration file and add all folders, that contain your model files. |
| 41 | + |
| 42 | +## Generating Diagrams |
| 43 | + |
| 44 | +You can generate entity relation diagrams using the provided artisan command: |
| 45 | + |
| 46 | +```bash |
| 47 | +php artisan generate:erd |
| 48 | +``` |
| 49 | + |
| 50 | +This will generate a file called `graph.png`. |
| 51 | + |
| 52 | +You can also specify a custom filename: |
| 53 | + |
| 54 | +```bash |
| 55 | +php artisan generate:erd output.png |
| 56 | +``` |
| 57 | + |
| 58 | +Or use one of the other [output formats](https://www.graphviz.org/doc/info/output.html), like SVG: |
| 59 | + |
| 60 | +```bash |
| 61 | +php artisan generate:erd output.svg --format=svg |
| 62 | +``` |
| 63 | + |
| 64 | +## Customization |
| 65 | + |
| 66 | +Please take a look at the published `erd-generator.php` configuration file for all available customization options. |
| 67 | + |
| 68 | +## Examples |
| 69 | + |
| 70 | +Here are some examples taken from the [Laravel.io](https://laravel.io) codebase. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +### Testing |
| 77 | + |
| 78 | +``` bash |
| 79 | +composer test |
| 80 | +``` |
| 81 | + |
| 82 | +### Changelog |
| 83 | + |
| 84 | +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
| 85 | + |
| 86 | +## Contributing |
| 87 | + |
| 88 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 89 | + |
| 90 | +### Security |
| 91 | + |
| 92 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 93 | + |
| 94 | +## Credits |
| 95 | + |
| 96 | +- [Marcel Pociot](https://github.com/mpociot) |
| 97 | +- [All Contributors](../../contributors) |
| 98 | + |
| 99 | +## License |
| 100 | + |
| 101 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments