- How does this package improve IDE support for enums in Laravel?
- It generates IDE-helper classes that provide autocompletion and type hints for PHP 8.1+ enums, making enum cases, methods, and Enumhancer features (like custom helpers) instantly discoverable in PhpStorm or VSCode without runtime overhead.
- Will this work with Laravel 9+ and PHP 8.1+?
- Yes, the package is fully compatible with Laravel 9+ and PHP 8.1+, as these versions natively support enums. No additional setup is required beyond installation.
- Do I need to manually configure Laravel or Composer for this?
- No configuration is needed for Laravel itself. Add the package as a dev dependency, then run `composer dump-autoload` to trigger helper generation. Optionally, add a `post-autoload-dump` script in `composer.json` for automation.
- What if my team uses VSCode instead of PhpStorm?
- The package works with both PhpStorm and VSCode (via PHP Intelephense). It enhances autocompletion for enums, but VSCode’s native support may vary slightly—test with your setup to confirm improvements.
- Can this handle enums with custom methods or `__toString()`?
- Yes, the generated helpers include metadata for custom enum methods and magic properties like `__toString()`. However, test edge cases (e.g., dynamic behavior) to ensure IDE hints match runtime behavior exactly.
- Is there a performance impact during development?
- The package adds a one-time code generation step (e.g., during `composer dump-autoload`). For projects with many enums, monitor CI/CD timing, but the impact is negligible for local development.
- How do I handle generated files in version control?
- Generated files should be excluded from `.gitignore` and regenerated in CI or locally. Document this workflow in your team’s setup to avoid conflicts when enums evolve.
- What if my project uses AGPL-licensed dependencies?
- This package is AGPL-3.0, which is viral. If your project is proprietary, evaluate alternatives like `spatie/enum` or `myclabs/php-enum` to avoid license conflicts.
- Does this replace Enumhancer’s runtime features?
- No, this package only generates IDE helper files. It doesn’t modify runtime behavior—Enumhancer’s core features (e.g., enum extensions) remain unchanged.
- How do I test if the helpers work correctly?
- Verify by creating a test enum with custom methods, then check if your IDE shows autocompletion for cases/methods. Compare IDE hints with runtime behavior to catch discrepancies.