kevincobain2000/laravel-erd
Laravel ERD generates entity relationship diagrams directly from your Laravel models. It scans relationships and exports interactive diagrams, helping you visualize and document your database schema without manual drawing. Simple to install, with customization options for complex applications.
Architecture fit. kevincobain2000/laravel-erd is a developer-tooling package, not a runtime dependency. It reflects over Eloquent model classes, walks their relationship methods (hasMany, belongsTo, belongsToMany, morph variants), builds a graph, and renders an ERD image. Architecturally this places it firmly in the local development / documentation layer, adjacent to things like Laravel Debugbar, IDE helpers, or migration linters. It should never sit on a request path or in a production container. That framing is the single most important evaluation criterion: it means the blast radius of adoption is small, and the cost of abandonment is low.
Integration feasibility. Mechanically trivial — a composer require --dev, a published config pointing at model directories/namespaces, and an artisan command or route that emits an artifact. The real feasibility questions are (a) composer constraint compatibility with the stack's Laravel and PHP versions, and (b) whether the renderer shells out to a Graphviz binary or bundles a JS/PHP renderer. The former is a hard gate; the latter determines whether CI and Docker images need a system package added. At 156 stars and a low composite score (1.63), the prior should be that the package lags current Laravel releases and that the maintainer cadence is thin — verify, don't assume.
Technical risk. Medium-low, entirely contained by keeping it dev-only. The material risks are: model-reflection fragility — relations defined conditionally, resolved through intermediate/custom relation classes, or requiring a booted container and live DB will silently drop from the diagram, producing a confidently wrong artifact; semantic drift — a model-derived ERD reflects intent in code, not the actual schema, so it will disagree with the database whenever migrations and models have diverged, which is precisely when you most want the diagram; abandonment — a low-star package with infrequent releases is a fork-it-later liability; and scope limits — no visibility into pivot columns, indexes, constraints, or FK cascades, which are usually the reason someone asks for an ERD in the first place.
Key questions.
composer.json constraints for laravel/framework and php, and does a release exist inside our supported matrix?morphTo, hasManyThrough, and custom Relation subclasses — skip, approximate, or crash?Stack fit. This slots in as a require-dev entry alongside existing quality tooling, gated behind a composer script or Make target (make erd). It must be excluded from production builds — confirm the deploy pipeline runs composer install --no-dev and that the package's service provider is not registered in config/app.php for non-local environments, or is auto-discovered but harmless. No application code, no autoloaded runtime surface, no config coupling beyond a published config/erd.php.
Migration path. None required in the traditional sense, because nothing is being replaced at runtime. The "migration" is a workflow change: teams currently either hand-draw diagrams in Lucidchart/draw.io (which rot immediately) or point a DB tool at a staging schema. The package's value proposition is replacing the hand-drawn artifact with a generated one. If the organization already generates schema-derived ERDs via SchemaSpy, DBeaver, or a mermaid-erd step in CI, this package is complementary, not substitutive — adopt it for the model-semantics view (relationship names, Eloquent-level naming) and keep the DB-derived tool as the authoritative schema record.
Compatibility. Two axes to verify before committing: framework/PHP version support, and system-level dependency on Graphviz. If the package predates the current Laravel major, options in order of preference are (1) pin to a working older tag in a throwaway branch and treat output as a one-off audit artifact rather than a pipeline step, (2) fork and bump the constraint — viable because the surface is small, (3) drop it in favor of a maintained alternative. Also check that model discovery doesn't collide with models that have side-effectful boot() methods or global scopes, which can turn a diagram command into an unexpected query storm.
Sequencing.
composer.json, CHANGELOG, open issues, last commit date. Time-box: 30 minutes. Kill criteria: no release compatible with the current Laravel major, or no license file.SHOW CREATE TABLE / an information_schema dump for the same tables. Record every missing or wrong edge. This is the decisive step: the delta between model-derived and schema-derived is the package's real accuracy budget.docs/erd/ path with a scheduled or pre-release job, so the artifact has an owner and a refresh cadence. Optionally add a PR comment or drift check, but do not block merges on it.Maintenance. Ongoing cost is near zero while it works and near zero if it breaks — the package touches no production path, so a failing diagram job is a nuisance, not an incident. The real maintenance liability is ownership of the artifact: a generated ERD that nobody regenerates is worse than no ERD, because it looks authoritative while going stale. Assign a named owner (typically the platform or backend lead) and a cadence tied to schema-changing releases, not to a calendar.
Support. Support surface is thin — small community, no vendor backing, low star count. Internal support burden falls on whoever ran the spike. Mitigate by forking into the org's GitHub namespace at adoption time if the package proves valuable and the upstream looks dormant; the code volume is small enough that a fork is cheap insurance. Budget roughly half a day for the fork-and-publish if it comes to that.
Scaling. Two distinct ceilings. Technical: reflection over hundreds of models means booting every model class, which gets slow and memory-hungry on large monoliths, and rendering a graph with hundreds of nodes produces an unreadable hairball regardless of the tool. Organizational: a single org-wide ERD is useless past a certain size — the diagram only earns its keep when scoped per bounded context or per module. Plan on running it with a namespace filter and producing several small diagrams rather than one large one. If someone asks for the whole-app picture, that request is better served by a DB-derived tool with interactive pan/zoom.
Failure modes. Ranked by likelihood: (1) missing Graphviz or equivalent system binary after an image bump — fails loudly, easy fix; (2) silent omission of relations the reflector can't resolve (morphs, custom relations, conditionally-registered relations) — fails quietly and is the dangerous one, so always spot-check against the schema; (3) model boot exceptions or unintended queries aborting the run; (4) composer constraint conflict after a Laravel upgrade, blocking composer update for the whole team until the dev dependency is patched or removed — worth remembering that a dev dependency can still block an upgrade, so keep it pinned loosely or be ready to drop it fast; (5) output drift between developers' machines producing noisy diffs in committed assets — pin the renderer version and prefer SVG for diff stability.
Ramp-up. Very shallow. A backend engineer can go from zero to a generated diagram in well under an hour; the README-level workflow (install, publish config, point at model directory, run command) is the whole learning curve. The non-obvious knowledge is entirely in the interpretation caveats — knowing which edges are missing and why — which is why the spike notes and the runbook matter more than the tooling itself. Onboarding cost for the wider team is effectively a paragraph in the contributing guide.
How can I help you explore Laravel packages today?