- How do I install and generate an ERD in Laravel using EasyERD?
- Run `composer require dgtlss/easyerd` to install, then execute `php artisan easyerd:generate` in your terminal. The package will create diagrams in your configured output path (default: `storage_path('app/erd')`). Use flags like `--format=svg` or `--type=text` to customize output.
- Does EasyERD support Laravel 10+ and PHP 8.1+?
- Yes, EasyERD is officially tested on Laravel 8.0+ and PHP 8.0+. While it may work on newer versions, always check the package’s changelog or GitHub issues for compatibility updates. PHP 8.1+ should work without issues unless Graphviz introduces breaking changes.
- Can I exclude specific tables or models from the ERD?
- Yes, EasyERD allows you to exclude tables or models via the `config/easyerd.php` file. Add an `exclude` array to the configuration to specify tables or models you want to omit from the generated diagram.
- How do I configure dark mode or high-resolution output?
- Set `dark_mode: true` in `config/easyerd.php` for dark-themed diagrams. For high-resolution output, adjust `image_width`, `image_height`, and `dpi` (e.g., `dpi: 600`). These settings are applied globally for all generated images.
- What are the system requirements for EasyERD (e.g., Graphviz, PHP extensions)?
- EasyERD requires **Graphviz** installed system-wide (e.g., `apt-get install graphviz` on Ubuntu). For image output, PHP extensions like `php-gd` or `php-imagick` are recommended but optional. Test your environment by running `php artisan easyerd:generate` after installation.
- How can I integrate ERD generation into a CI/CD pipeline?
- Add `php artisan easyerd:generate` to your CI script, but ensure Graphviz is installed in your CI environment (e.g., Docker containers). Cache the generated diagrams to avoid redundant builds. For production, consider generating diagrams post-deploy via a scheduled job.
- Does EasyERD work with polymorphic relationships or complex many-to-many pivots?
- EasyERD handles standard Laravel relationships well, but complex cases like polymorphic or highly customized pivots may require manual adjustments in the configuration. Test with your schema to ensure accuracy, and use the `table_styles` array to tweak visual representation.
- Can I generate ERDs programmatically (e.g., via a controller or API)?
- Yes, EasyERD provides a service container binding. Inject the `EasyErd` facade or use dependency injection to trigger generation programmatically. Example: `$erd = app('easyerd'); $erd->generate();`. This is useful for embedding diagrams in admin panels or APIs.
- What’s the best way to handle Graphviz dependency in Docker or serverless environments?
- For Docker, include `graphviz` in your `Dockerfile` (e.g., `RUN apt-get install -y graphviz`). For serverless, offload generation to a separate function or use a pre-built image with Graphviz installed. Avoid bundling Graphviz in your app’s Composer dependencies.
- Are there alternatives to EasyERD for Laravel ERD generation?
- Alternatives include **Laravel ERD** (simpler but less configurable) or **Mermaid.js** (text-based diagrams rendered client-side). EasyERD stands out for its Graphviz-powered layouts, dark mode, and high-resolution output, but Mermaid.js may be preferable for web-based, interactive diagrams without server dependencies.