kevincobain2000/laravel-erd
Composer 安装命令:
composer require kevincobain2000/laravel-erd
包简介
A tool to automatically generate interactive ERD relationships in Models for Laravel
README 文档
README
Automatically generate interactive ERD from Models relationships in Laravel.
- This package provides a CLI to automatically generate interactive ERD by looking into relationships setup inside Models.
- The tool's interface is available to get JSON data of relationships and table schema from Models to be used by visual charts libraries of your choice such as d3.js etc
- Output is an interactive ERD (Entity Relation Diagram) powered by HTML and JS (GOJS).
| Lang | Link |
|---|---|
| Details | Medium Article |
| Demo | Online Demo |
Requirements
| Lang | Version |
|---|---|
| PHP | 7.4 or 8.0 |
| Laravel | 6.* or 8.* |
Installation
You can install the package via composer:
composer require kevincobain2000/laravel-erd --dev
You can publish the config file with:
php artisan vendor:publish --provider="Kevincobain2000\LaravelERD\LaravelERDServiceProvider"
Usage
You can access the ERD in localhost:3000/erd
or generate a static HTML
php artisan erd:generate
ERD HTML is generated inside docs/.
Sample
Screenshot
Get JSON output
use Kevincobain2000\LaravelERD\LaravelERD; $modelsPath = base_path('app/Models'); $laravelERD = new LaravelERD(); $linkDataArray = $laravelERD->getLinkDataArray($modelsPath); $nodeDataArray = $laravelERD->getNodeDataArray($modelsPath); $erdData = json_encode( [ "link_data" => $linkDataArray, "node_data" => $nodeDataArray, ], JSON_PRETTY_PRINT ); var_dump($erdData);
Sample JSON output
{ "link_data": [ { "from": "comments", "to": "users", "fromText": "1..1\nBT", "toText": "", "fromPort": "author_id", "toPort": "id", "type": "BelongsTo" }, { "from": "comments", "to": "posts", "fromText": "1..1\nBT", "toText": "", "fromPort": "post_id", "toPort": "id", "type": "BelongsTo" }, ... ... ], "node_data": [ { "key": "comments", "schema": [ { "name": "id", "isKey": true, "figure": "Hexagon", "color": "#be4b15", "info": "integer" }, { "name": "author_id", "isKey": false, "figure": "Decision", "color": "#6ea5f8", "info": "integer" }, ... ... } ... ]
Testing
./vendor/bin/phpunit
Changelog
- Initial Release - POC
kevincobain2000/laravel-erd 适用场景与选型建议
kevincobain2000/laravel-erd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 289.64k 次下载、GitHub Stars 达 156, 最近一次更新时间为 2021 年 07 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kevincobain2000」 「laravel erd generator」 「laravel-erd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kevincobain2000/laravel-erd 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kevincobain2000/laravel-erd 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kevincobain2000/laravel-erd 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP backend data provider for database relationship visualization. Collects customer data across multiple databases and computes relationship matches for consumption by dbrel-viz.
Laravel package to generate comprehensive markdown documentation for project files and database schema with AI-readable output
Alfabank REST API integration
A Laravel package to generate ERD diagrams from models and migrations
Visual dashboard for Laravel Eloquent models — see relationships, scopes, casts, policies, and complexity at a glance. No database queries.
A drag-and-drop visual database designer for Laravel with professional ERD design capabilities. Shared hosting compatible with no build process required.
统计信息
- 总下载量: 289.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 156
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-24