承接 northwestern-sysdev/er-diagram-tool 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

northwestern-sysdev/er-diagram-tool

最新稳定版本:v1.1.0

Composer 安装命令:

composer require northwestern-sysdev/er-diagram-tool

包简介

Automatically generate entity relationship diagrams for a Laravel application

README 文档

README

Automatically generate interactive entity relationship diagram for models & their relationships in Laravel and emit a static HTML file for use in a VuePress site.

This package is a heavily-customized fork from kevincobain2000/laravel-erd meant for use in some very specific circumstances. If you're not part of @NIT-Administrative-Systems, you should probably check out the original package instead!

The changes include:

  • Adding ribbons to models in the diagram with PHP attributes on the model class
  • Different default settings for goJS to render huge diagrams efficiently
  • Different default settings for discovering models in App\Domains\<something>\Models namespaces

Installation

You can install the package via composer.

composer require northwestern-sysdev/er-diagram-tool --dev

Usage

You can generate a static HTML file with the artisan command:

php artisan erd:generate

This will be placed in docs/.vuepress/public/erd, or whatever path you have configured in config/laravel-erd.php.

Using Ribbons

Enabling ribbon support is done by registering a function to get ribbons.

First, create an attribute with some properties you want to include in the ribbon:

#[Attribute(Attribute::TARGET_CLASS)] class LookupAttr { public function __construct( public readonly string $source, ) { // } }

Next, register a callback in a provider's

class AppServiceProvider extends ServiceProvider { public function boot(): void { /** @var ModelRibbonAdapter $adapter */ $adapter = resolve(ModelRibbonAdapter::class); \Kevincobain2000\LaravelERD\LaravelERDServiceProvider::setRibbonClosure($adapter->callback()); } private function ribbonCallback(): Closure { return function (Model $model) { $reflection = new ReflectionClass($model); $attributes = collect($reflection->getAttributes()) ->map->newInstance() ->filter(fn (object $attrObj) => $attrObj instanceof LookupAttr); return $attributes ->map(function (LookupAttr $attr) { return new \Kevincobain2000\LaravelERD\Diagram\Ribbon( text: $attribute->source, bgColour: '#FFE342', textColour: 'black', ); }) ->first(); }; } }

And then use the attribute on some models:

#[LookupAttr('Student System')] class DegreeType extends Model { // . . . }

This will pick them up and add a ribbon with the "Student System" text on it, indicating the table is populated from the student system's degree types.

统计信息

  • 总下载量: 32.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固