PHP Insights created and maintained by Nuno Maduro, is the perfect starting point to analyze the code quality of your PHP projects. Carefully crafted to simplify the analysis of your code directly on your terminal.
🚨 This project is under development. Don't use it!.
- Analysis of lines of code and cyclomatic complexity
- Beautiful overview of your code structure and it's dependencies
- Contains built-in checks for making code reliable, loosely coupled, simple, and clean
Requires:
First, install PHP Insights via the Composer package manager:
composer require nunomaduro/phpinsights:dev-feat/firstUse the phpinsights binary:
php ./vendor/bin/phpinsightsYou can publish the config-file with:
php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider" Open config/insights.php, and update the preset to laravel.
Use the insights Artisan command:
php artisan insightsThe project is under development. As such, any help is welcome!
Imagine that you want to create a new Insight that don't allow the usage of final classes:
- Create a new file under
Domain\Insightswith the content:
final class ForbiddenFinalClasses extends Insight { /** * {@inheritdoc} */ public function hasIssue(): bool { return (bool) count($this->collector->getConcreteFinalClasses()); } /** * {@inheritdoc} */ public function getTitle(): string { return 'The use of `final` classes is prohibited'; } }- Attach the
Insightto a specific insideDomain/Metrics/:
final class ClassesFinal implements HasValue, HasPercentage, HasInsights { // ... /** * {@inheritdoc} */ public function getInsights(): array { return [ ForbiddenFinalClasses::class, ]; } }PHP Insights is an open-sourced software licensed under the MIT license.
