- How do I install laravel-erd in a Laravel project?
- Install it as a dev dependency with composer require --dev kevincobain2000/laravel-erd, publish the package config, and point it at your model directories or namespaces. Then run the package's Artisan command or route to emit the diagram. Keep it out of production builds and composer install --no-dev deployments.
- Does laravel-erd support my Laravel and PHP versions?
- Check the package's composer.json for its laravel/framework and php constraints and confirm a release exists inside your supported matrix. Because the package has a low composite score and likely thin release cadence, do not assume current Laravel support. Treat Composer constraint compatibility as a hard adoption gate.
- Is laravel-erd safe to use in production?
- No, laravel-erd is developer tooling for local development and documentation, not a runtime dependency. Keep it in require-dev and ensure production images and deployments run composer install --no-dev. It should never sit on a request path or in a production container.
- How does laravel-erd discover my Eloquent models?
- It uses a published config that points at model directories or namespaces, then scans those model classes for Eloquent relationship methods. You can scope it to a bounded context to keep the diagram readable. Verify whether your setup uses an explicit model list, namespace glob, or directory scan.
- Does laravel-erd need a database or a booted Laravel app?
- laravel-erd reflects over model classes and walks relationship methods; it does not introspect the live database schema. Some relations may require a booted application container or resolvable model context, so test discovery in your app. A model-derived ERD can disagree with the actual database when migrations and models have diverged.
- What relationship types does laravel-erd support?
- The package is designed around Eloquent relations such as hasMany, belongsTo, belongsToMany, and morph variants. Custom Relation subclasses, morphTo, and hasManyThrough may be skipped, approximated, or handled differently, so verify your specific relation types. It is not a schema introspection tool for pivot columns, indexes, constraints, or FK cascades.
- What output format does laravel-erd generate?
- It exports interactive ERD diagrams generated from your models, typically as a rendered image or HTML artifact depending on the renderer. Confirm the exact output format before committing diagrams to the repo or publishing to a docs site. Deterministic output is useful for documentation but should be regenerated when model relations change.
- Does laravel-erd require Graphviz to render diagrams?
- That depends on the renderer: it may shell out to a Graphviz binary or bundle a JavaScript/PHP renderer. If Graphviz is required, add it to CI runners, Docker images, and developer laptops. Check this before standardizing on the package because it affects onboarding and pipeline reliability.
- Can I customize or scope the ERD output?
- Yes. The published config lets you point at model directories and namespaces, and you can scope generation to a bounded context for complex applications. Customization is mainly around which models are included rather than database-level schema detail. Keep the generated artifact as documentation, not as a source of truth for indexes or constraints.
- Is laravel-erd maintained, and what are the alternatives?
- The package has low stars and a low composite score, so treat maintenance cadence and last release date as adoption risks and be prepared to fork it later. It is fine for a lightweight model-relation diagram but limited for schema-level ERD needs. If you need indexes, constraints, and FK cascades, compare schema-derived tools such as SchemaSpy or DBeaver before choosing.