Download the PHP package recca0120/laravel-erd without Composer
On this page you can find all versions of the php package recca0120/laravel-erd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download recca0120/laravel-erd
More information about recca0120/laravel-erd
Files in recca0120/laravel-erd
Package laravel-erd
Short Description Laravel ERD automatically generates Entity-Relationship Diagrams from your Laravel models and displays them using Vuerd.
License MIT
Informations about the package laravel-erd
Laravel ERD
繁體中文
Laravel ERD automatically generates Entity-Relationship Diagrams from your Laravel Eloquent models. No real database connection required — it uses an in-memory SQLite database by default, so you can generate ERDs anywhere, including CI/CD pipelines.
It displays the results using the interactive erd-editor web component, or exports to SVG.
Preview
Requirements
| Dependency | Version |
|---|---|
| PHP | 8.1, 8.2, 8.3, 8.4 |
| Laravel | 8, 9, 10, 11, 12 |
Installation
Quick Start
1. Generate the ERD
This scans your app/ directory for Eloquent models, runs your migrations on an in-memory SQLite database, and generates a .sql DDL file.
2. View in Browser
Visit your application at:
The interactive editor supports dark mode, automatic layout, and a theme builder.
Output Formats
The output format is determined by the --file extension:
| Extension | Format | Description | Requires Binary |
|---|---|---|---|
.sql |
SQL DDL | CREATE TABLE and ALTER TABLE statements (default) | No |
.er |
ER Notation | Entity-relationship notation viewable in erd-editor | No |
.svg |
SVG Diagram | Visual diagram with zoom/pan support | Yes |
Generating SVG
SVG output requires the erd-go and graphviz-dot binaries. Install them with:
Then generate:
View at: http://localhost/laravel-erd/erd.svg
Command Options
| Option | Description | Default |
|---|---|---|
database |
Database connection name to use | database.default from config |
--directory |
Directory to scan for Eloquent models | app/ |
--file |
Output filename (extension determines format) | {database}.sql |
--path |
Migration path (passed to artisan migrate) |
— |
--regex |
File pattern to match models | *.php |
--excludes |
Comma-separated table names to exclude | — |
--graceful |
Print error message instead of throwing an exception | false |
Examples
Supported Relationships
Laravel ERD detects the following Eloquent relationships:
BelongsToHasOne/HasManyBelongsToManyMorphOne/MorphMany/MorphTo/MorphToMany- Compoships (composite key relationships)
Configuration
Publish the config file:
This creates config/laravel-erd.php:
Custom Output Path
By default, generated files are stored in storage/framework/cache/laravel-erd/. To save ERDs as project documentation:
Web Viewer Middleware
Protect the web viewer in production:
Per-Connection Database Overrides
By default, all database connections are replaced with in-memory SQLite during ERD generation. This means you don't need a running database server.
If you need a specific connection to use a real database (e.g., for database-specific column types), you can override it:
Connections not listed here will continue to use the default in-memory SQLite.
How It Works
- Backup — Current database and cache configuration is saved
- Override — All connections are replaced with in-memory SQLite (unless overridden in config)
- Migrate — Runs
artisan migrateto create the schema - Scan — Finds Eloquent models in the target directory using
nikic/php-parser - Analyze — Discovers relationships by inspecting model methods
- Generate — Outputs the ERD in the requested format
- Restore — Original database configuration is restored
Your actual database is never modified.
Publishable Assets
| Asset | Destination |
|---|---|
| Config | config/laravel-erd.php |
| Views | resources/views/vendor/laravel-erd/ |
| Frontend assets | public/vendor/laravel-erd/ |
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-erd with dependencies
illuminate/collections Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0|dev-master
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/filesystem Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
nikic/php-parser Version ^5.1.0
php-http/client-common Version ^2.7