nunomaduro/phpinsights
PHP Insights analyzes PHP code quality, style, architecture, and complexity from your terminal. Works out of the box with Laravel (artisan insights), Symfony, Yii, Magento, and more, with built-in checks for reliability and loose coupling.
Strengths:
InsightsServiceProvider, aligning with Laravel’s CLI-driven workflow (e.g., php artisan insights).phpinsights.json, reducing false positives/negatives.phpinsights:add-insight), enabling team-specific standards.Gaps:
Laravel Compatibility:
InsightsServiceProvider and php artisan insights command.--dev dependency).php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider".phpinsights.json (e.g., adjust cyclomatic complexity thresholds).Non-Laravel PHP Projects:
artisan commands).Adoption Context:
Integration Depth:
Customization:
Toolchain Synergy:
Operational Overhead:
php artisan commands for quality checks.php artisan insights interface../vendor/bin/phpinsights with manual config.Assessment Phase:
composer require nunomaduro/phpinsights --dev in a staging environment.php artisan insights (Laravel) or ./vendor/bin/phpinsights (vanilla) to generate a baseline report.phpinsights.json thresholds.Pilot Integration:
- name: Run PHP Insights
run: php artisan insights --min-quality=80 --no-cache
.husky/pre-commit:
#!/bin/sh ./vendor/bin/phpinsights --no-cache
Full Rollout:
php artisan vendor:publish.ForbiddenTraits if traits are heavily used).composer why-not nunomaduro/phpinsights to identify potential issues.phpinsights.json to reduce noise (e.g., increase maxMethodComplexity for legacy code).<80 score).phpinsights.json may diverge across environments if not version-controlled.config/phpinsights.json) and document custom rules.composer.json or use ^ for minor updates.artisan command); higher for vanilla PHP.--verbose flag for detailed logs.--cache flag).phpinsights.json).phpinsights.json and validate in CI.| Failure Mode | Impact |
How can I help you explore Laravel packages today?