bugo / filament-er-diagram
Live ER diagram panel for FilamentPHP 5 — auto-detects Eloquent models and relationships
0.2
2026-04-30 02:55 UTC
Requires
- php: ^8.2
- filament/filament: ^5.6
- spatie/laravel-package-tools: ^1.93
Requires (Dev)
- laravel/pint: ^1.29
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- rector/rector: ^2.4
README
A Filament 5 plugin that generates a live, interactive ER diagram directly inside your admin panel.
It auto-discovers all Eloquent models in a given directory, reads their database columns via Schema, detects relationships via Reflection, and renders an interactive force-directed graph powered by D3.js.
Features
- 🔍 Auto-discovers Eloquent models — no configuration needed for basic use
- 🔗 Detects
hasMany,hasOne,belongsTo,belongsToMany,morphMany,morphOneandThroughvariants - 🏷️ Shows table name, column names, types, PK and FK badges
- 🖱️ Draggable nodes, pan & zoom, click-to-highlight connected models
- 🔎 Real-time model search
- 💾 One-click export to SVG or PNG
- 🌙 Full dark mode support
- ⚙️ Fully configurable via fluent plugin API
Installation
composer require bugo/filament-er-diagram
Requires a custom Filament theme. Add the plugin's views to your theme's CSS source:
@source '../../../../vendor/bugo/filament-er-diagram/resources/**/*.blade.php';
Publish the config (optional):
php artisan vendor:publish --tag="filament-er-diagram-config"
Build the JS assets:
php artisan filament:assets
Usage
Register the plugin in your AdminPanelProvider:
use Bugo\FilamentErDiagram\ErDiagramPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ ErDiagramPlugin::make(), ]); }
The panel now has an ER Diagram page under the Tools navigation group.
Customisation
ErDiagramPlugin::make() ->modelsPath('app/Domain/Models') // custom directory ->excludeModels([PersonalAccessToken::class]) ->withoutColumns() // hide column details ->withoutRelationshipLabels() // hide edge labels ->navigationGroup('Developer') ->navigationSort(10) ->navigationIcon('heroicon-o-table-cells'),
Artisan command
# Print a table summary php artisan er-diagram:generate --path=app/Models # Print clean JSON to stdout php artisan er-diagram:generate --format=json --path=app/Models # Save JSON to file php artisan er-diagram:generate --format=json --output=er-diagram.json # Exclude specific models php artisan er-diagram:generate --exclude=App\\Models\\PersonalAccessToken