Relationship Graph Visualization

Generate interactive, standalone HTML visualizations of your model relationships with a single command.

The Command

$ php artisan model-analyzer:visualize

Analyzing model relationships...

Graph generated: model-relationships.html
  6 models, 16 relationships, health score: 62/100

Options

Option Description Default
--output Output file path for the generated HTML model-relationships.html
--models Comma-separated list of model names to include all
--erd Generate an Entity Relationship Diagram instead of a force-directed graph false
--format Output format: html (interactive, D3.js) or svg (static, embeddable) html

Filter Specific Models

$ php artisan model-analyzer:visualize --models=User,Post --output=user-posts.html

Analyzing model relationships...

Graph generated: user-posts.html
  2 models, 8 relationships, health score: 63/100

Graph Features

Force-Directed Layout

Models automatically arrange themselves with physics-based positioning using D3.js.

Drag & Zoom

Drag nodes to rearrange, scroll to zoom, and pan across the canvas.

Color-Coded Status

Green for healthy, yellow for warnings, red for errors — issues visible at a glance.

Hover Tooltips

Hover over any node to see model details, table name, and specific issues.

Curved Link Labels

Parallel relationships use curved paths so labels never overlap — every link is readable.

Standalone HTML

Zero dependencies — open the file in any browser, share with your team, or add to docs.

Live Preview: Relationship Graph

This is the actual output generated by running php artisan model-analyzer:visualize against the 6 demo models.

Entity Relationship Diagram (ERD)

Use the --erd flag to generate a traditional ERD with table boxes, columns, data types, and crow's foot cardinality notation.

$ php artisan model-analyzer:visualize --erd

Analyzing model relationships...

ERD generated: model-erd.html
  6 models, 16 relationships, health score: 62/100
Table Boxes

Each model rendered as an SVG table with header, columns, PK/FK icons, and data types.

Crow's Foot Notation

Industry-standard cardinality markers: one-to-many (1—*), one-to-one (1—1), many-to-many (*—*).

Missing Column Detection

Columns referenced in relationships but missing from the schema are shown in red with a warning icon.

Static SVG Output

Use --format=svg to generate static SVG files — perfect for embedding in docs, presentations, READMEs, or anywhere you need a lightweight, scalable diagram without JavaScript.

$ php artisan model-analyzer:visualize --format=svg

Analyzing model relationships...

Graph generated: model-relationships.svg
  6 models, 16 relationships, health score: 62/100

Relationship Graph (SVG)

Model Relationship Graph (SVG)
$ php artisan model-analyzer:visualize --erd --format=svg

Analyzing model relationships...

ERD generated: model-erd.svg
  6 models, 16 relationships, health score: 62/100

Entity Relationship Diagram (SVG)

Entity Relationship Diagram (SVG)

Node Color Legend

Green

No issues detected

Yellow

Warnings (missing index, missing inverse)

Red

Errors (missing column, missing model)