- How do I install this package in my Laravel project?
- Run `composer require --dev wyrihaximus/phpstan-rules-wrapper` in your project root. The package integrates automatically with `phpstan/extension-installer`, so no additional setup is needed beyond updating your `phpstan.neon` to include the bundled rules.
- Does this work with Laravel 10.x or older PHP versions?
- The package requires PHP 8.4+, so Laravel 10.x (PHP 8.2+) may need an upgrade. If you’re stuck on older versions, consider manually installing individual rule sets or waiting for a PHP 8.2-compatible wrapper release.
- Can I disable or customize specific rules from the wrapper?
- Yes. The wrapper bundles rules but doesn’t enforce them—you can disable or override any rule in your `phpstan.neon` config. For example, add `exclude-rules: [rule-name]` to skip unwanted checks.
- Will this slow down my CI/CD pipeline significantly?
- The wrapper adds 10+ rule sets, which may increase PHPStan execution time. Test it locally first with `--level=max` to benchmark. For large projects, consider caching results or running in parallel.
- Are there Laravel-specific rules included, like no-hardcoded-config checks?
- No, this is a generic PHPStan wrapper. For Laravel-specific rules, you’ll need to add them manually (e.g., `nunomaduro/phpstan-laravel`) or check if they’re included in future wrapper updates.
- How do I update the wrapper without breaking my config?
- Use `composer update wyrihaximus/phpstan-rules-wrapper` and review the [changelog](https://github.com/WyriHaximus/php-phpstan-rules-wrapper/blob/main/CHANGELOG.md) for breaking changes. The wrapper follows semantic versioning, so minor updates should be safe.
- Does this conflict with existing PHPStan extensions in my project?
- The wrapper disables some rules by default (e.g., `ergebnis/noPhpstanIgnore`) to avoid conflicts. Review the [disabled rules list](https://github.com/WyriHaximus/php-phpstan-rules-wrapper#disabled-rules) and re-enable them if safe for your project.
- Can I use this with GitHub Actions or other CI tools?
- Absolutely. The wrapper works with any PHPStan-compatible CI setup. Example: Add `vendor/bin/phpstan analyse --level=max app/` to your workflow. It integrates seamlessly with tools like GitHub Actions, GitLab CI, or Laravel Forge.
- What if I only need a subset of the bundled rules?
- You can exclude specific rule sets in your `phpstan.neon` by modifying the `includes` section. For example, remove `phpstan-phpunit` if you don’t use PHPUnit tests. The wrapper doesn’t enforce all rules by default.
- Is there a downside to using this instead of installing rules individually?
- The main trade-off is dependency management: the wrapper abstracts versions, which simplifies updates but could cause issues if a bundled rule set requires a patch outside the wrapper’s release cycle. For fine-grained control, manual installation is an alternative.