There is one package that does wonderful job – generates PNG image with your DB schema, from your Laravel models. It’s called Laravel ER Diagram Generator by BeyondCode company.

Installation of the package is easy and described in their Readme file, but I will recap with example.

1. Make sure you have graphviz library on your computer.
2. Install the package by running composer require beyondcode/laravel-er-diagram-generator –dev (that flag –dev means you will need this package only on your local/dev environment)
3. Run command php artisan generate:erd

And, that’s it – it will generate a PNG file for you, in the main project folder.

Here’s what graph.png it generated for default QuickAdminPanel project:


There are a few customizations available, you can test them out, and also try the package on bigger databases.

You can also use MySQL Workbench to achieve similar result, watch my video about it.