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
Models automatically arrange themselves with physics-based positioning using D3.js.
Drag nodes to rearrange, scroll to zoom, and pan across the canvas.
Green for healthy, yellow for warnings, red for errors — issues visible at a glance.
Hover over any node to see model details, table name, and specific issues.
Parallel relationships use curved paths so labels never overlap — every link is readable.
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
Each model rendered as an SVG table with header, columns, PK/FK icons, and data types.
Industry-standard cardinality markers: one-to-many (1—*), one-to-one (1—1), many-to-many (*—*).
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)
$ 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)
Node Color Legend
No issues detected
Warnings (missing index, missing inverse)
Errors (missing column, missing model)