# febryan1453/laravel-erd architecture

> Architecture diagram of the GitHub repository febryan1453/laravel-erd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/febryan1453/laravel-erd
- Repository: https://github.com/febryan1453/laravel-erd

## Overview

Laravel ERD Generator scans Laravel Eloquent models, derives relationship links and table-column nodes, then serves an interactive diagram or writes static HTML. The web route delegates to a controller; the CLI command independently invokes the same generator. The template renders and filters the returned data with GoJS. The core implementation is excerpted; relationships among Laravel package-tool registrations and runtime wiring are included only where the shown source or README supports them.

Main entry points: [`src/Commands/LaravelERDCommand.php`](https://github.com/febryan1453/laravel-erd/blob/master/src/Commands/LaravelERDCommand.php) (Generate command), [`src/LaravelERD.php`](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php) (ERD data), [`src/Controllers/LaravelERDController.php`](https://github.com/febryan1453/laravel-erd/blob/master/src/Controllers/LaravelERDController.php) (Web controller), [`routes/web.php`](https://github.com/febryan1453/laravel-erd/blob/master/routes/web.php) (Web route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Laravel entry points"]
  node_provider["Package provider"]
  node_config["Package config<br/>[laravel-erd.php]"]
  node_webroute["Web route<br/>[web.php]"]
  node_controller["Web controller"]
  node_command["Generate command"]
end

subgraph group_generation["ERD generation"]
  node_discovery["Model discovery<br/>[LaravelERD.php]"]
  node_relations["Relation inspection<br/>[LaravelERD.php]"]
  node_schema["Schema extraction<br/>[LaravelERD.php]"]
  node_payload["ERD data<br/>[LaravelERD.php]"]
end

subgraph group_presentation["Diagram output"]
  node_template["Diagram template<br/>[index.blade.php]"]
  node_gojs["GoJS renderer"]
end

node_developer(("Developer"))
node_models[("Eloquent models")]
node_db[("Laravel database")]
node_htmlfiles[("HTML files")]

node_developer -->|"runs"| node_command
node_developer -->|"opens"| node_webroute
node_provider -->|"registers"| node_command
node_provider -->|"loads"| node_webroute
node_webroute -->|"routes to"| node_controller
node_webroute -->|"reads"| node_config
node_controller -->|"reads"| node_config
node_controller -->|"requests"| node_payload
node_command -->|"reads"| node_config
node_command -->|"requests"| node_payload
node_discovery -->|"scans"| node_models
node_relations -->|"reflects"| node_models
node_schema -->|"reads schema"| node_db
node_payload -->|"finds models"| node_discovery
node_payload -->|"collects links"| node_relations
node_payload -->|"collects nodes"| node_schema
node_controller -->|"renders"| node_template
node_command -->|"renders"| node_template
node_command -->|"writes HTML"| node_htmlfiles
node_template -->|"renders diagram"| node_gojs

click node_provider "https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERDServiceProvider.php"
click node_config "https://github.com/febryan1453/laravel-erd/blob/master/config/laravel-erd.php"
click node_webroute "https://github.com/febryan1453/laravel-erd/blob/master/routes/web.php"
click node_controller "https://github.com/febryan1453/laravel-erd/blob/master/src/Controllers/LaravelERDController.php"
click node_command "https://github.com/febryan1453/laravel-erd/blob/master/src/Commands/LaravelERDCommand.php"
click node_discovery "https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php"
click node_relations "https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php"
click node_schema "https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php"
click node_payload "https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php"
click node_template "https://github.com/febryan1453/laravel-erd/blob/master/resources/views/index.blade.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_provider,node_config,node_webroute,node_controller,node_command toneBlue
class node_discovery,node_relations,node_schema,node_payload,node_models,node_db,node_htmlfiles toneAmber
class node_template,node_gojs toneMint
class node_developer toneIndigo
```

## Components

### Laravel entry points

- [Package provider](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERDServiceProvider.php): `src/LaravelERDServiceProvider.php`
- [Package config](https://github.com/febryan1453/laravel-erd/blob/master/config/laravel-erd.php): `config/laravel-erd.php`
- [Web route](https://github.com/febryan1453/laravel-erd/blob/master/routes/web.php): `routes/web.php`
- [Web controller](https://github.com/febryan1453/laravel-erd/blob/master/src/Controllers/LaravelERDController.php): `src/Controllers/LaravelERDController.php`
- [Generate command](https://github.com/febryan1453/laravel-erd/blob/master/src/Commands/LaravelERDCommand.php): `src/Commands/LaravelERDCommand.php`

### ERD generation

- [Model discovery](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php): `src/LaravelERD.php`
- [Relation inspection](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php): `src/LaravelERD.php`
- [Schema extraction](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php): `src/LaravelERD.php`
- [ERD data](https://github.com/febryan1453/laravel-erd/blob/master/src/LaravelERD.php): `src/LaravelERD.php`

### Diagram output

- [Diagram template](https://github.com/febryan1453/laravel-erd/blob/master/resources/views/index.blade.php): `resources/views/index.blade.php`
- **GoJS renderer**

### Other components

- **Developer**
- **Eloquent models**
- **Laravel database**
- **HTML files**

## Connections

- Developer → Generate command: runs (evidence: `README.md`)
- Developer → Web route: opens (evidence: `README.md`)
- Package provider → Generate command: registers (evidence: `src/LaravelERDServiceProvider.php`)
- Package provider → Web route: loads (evidence: `src/LaravelERDServiceProvider.php`)
- Web route → Web controller: routes to (evidence: `routes/web.php`)
- Web route → Package config: reads (evidence: `routes/web.php`)
- Web controller → Package config: reads (evidence: `src/Controllers/LaravelERDController.php`)
- Web controller → ERD data: requests (evidence: `src/Controllers/LaravelERDController.php`)
- Generate command → Package config: reads (evidence: `src/Commands/LaravelERDCommand.php`)
- Generate command → ERD data: requests (evidence: `src/Commands/LaravelERDCommand.php`)
- Model discovery → Eloquent models: scans (evidence: `src/LaravelERD.php`)
- Relation inspection → Eloquent models: reflects (evidence: `src/LaravelERD.php`)
- Schema extraction → Laravel database: reads schema (evidence: `src/LaravelERD.php`)
- ERD data → Model discovery: finds models (evidence: `src/LaravelERD.php`)
- ERD data → Relation inspection: collects links (evidence: `src/LaravelERD.php`)
- ERD data → Schema extraction: collects nodes (evidence: `src/LaravelERD.php`)
- Web controller → Diagram template: renders (evidence: `src/Controllers/LaravelERDController.php`)
- Generate command → Diagram template: renders (evidence: `src/Commands/LaravelERDCommand.php`)
- Generate command → HTML files: writes HTML (evidence: `src/Commands/LaravelERDCommand.php`)
- Diagram template → GoJS renderer: renders diagram (evidence: `resources/views/index.blade.php`)
