rtcoder/laravel-db-erd
最新稳定版本:0.1.10
Composer 安装命令:
composer require rtcoder/laravel-db-erd
包简介
Laravel package to generate database ERD diagrams.
README 文档
README
A Laravel package for generating Entity-Relationship Diagrams (ERD) of your database schema. This tool is designed to support multiple database systems like MySQL, PostgreSQL, SQLite, SQL Server, and Oracle.
Features
- Automatically scans your database schema for tables and their relationships.
- Generates ERD diagrams in PDF format using Graphviz.
- Extensible design with support for multiple database drivers.
Installation
Requirements
- PHP 8.1 or higher
- Laravel 9.x or higher
- Graphviz installed on your system
Step 1: Install the package
composer require rtcoder/laravel-db-erd
Step 2: Publish the configuration (optional)
If you need to customize the behavior, publish the configuration file:
php artisan vendor:publish --tag=db-erd-config
If you need to customize the views, you can publish them using:
php artisan vendor:publish --tag=db-erd-views
This will copy the default views to your project's resources/views/vendor/laravel-erd directory, where you can modify them as needed.
Step 3: Install Graphviz
Ensure Graphviz is installed on your system.
On macOS:
brew install graphviz
On Ubuntu:
sudo apt install graphviz
On Windows:
Download and install from Graphviz's official site.
Usage
Generate an ERD Run the following Artisan command to generate the ERD:
php artisan erd:generate --output=storage/erd/erd_diagram.pdf --driver=mysql
The --output option specifies the file path for the generated diagram.
Supported Databases
- MySQL
- PostgreSQL
- SQLite
- SQL Server
- Oracle
Supported output formats
- SVG
- PNG
- HTML
Configuration
You can customize the package by modifying the configuration file (config/db-erd.php):
return [ 'default_driver' => env('DB_ERD_DRIVER', 'mysql'), 'output_directory' => storage_path('erd'), 'output_name' => 'erd_diagram', 'output_format' => 'pdf', 'exclude_tables' => ['migrations', 'jobs', 'failed_jobs'], ];
Troubleshooting
-
Graphviz not foundError
Ensure Graphviz is correctly installed and added to your system's PATH. -
Empty ERD Diagram
Verify that your database schema has relationships (foreign keys).
License
This package is open-source software licensed under the MIT license.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-08