bugo/filament-er-diagram

Live ER diagram panel for FilamentPHP 5 — auto-detects Eloquent models and relationships

Maintainers

Package info

github.com/dragomano/filament-er-diagram

pkg:composer/bugo/filament-er-diagram

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.2 2026-04-30 02:55 UTC

This package is auto-updated.

Last update: 2026-04-30 02:59:29 UTC


README

PHP Coverage Status

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.

Image

Features

  • 🔍 Auto-discovers Eloquent models — no configuration needed for basic use
  • 🔗 Detects hasMany, hasOne, belongsTo, belongsToMany, morphMany, morphOne and Through variants
  • 🏷️ 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