Skip to content

patrickbrouwers/phpinsights

 
 

Repository files navigation

PHP Insights

Build Status Total Downloads Latest Version License

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!.

✨ Features

  • 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

👉🏻 Installation & Usage

Requires:

First, install PHP Insights via the Composer package manager:

composer require nunomaduro/phpinsights:dev-feat/first

Without frameworks

Use the phpinsights binary:

php ./vendor/bin/phpinsights

Within Laravel

You 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 insights

💡 How to contribute

The project is under development. As such, any help is welcome!

Create a new Insight

Imagine that you want to create a new Insight that don't allow the usage of final classes:

  1. Create a new file under Domain\Insights with 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'; } }
  1. Attach the Insight to a specific inside Domain/Metrics/:
final class ClassesFinal implements HasValue, HasPercentage, HasInsights { // ... /**  * {@inheritdoc}  */ public function getInsights(): array { return [ ForbiddenFinalClasses::class, ]; } }

🆓 License

PHP Insights is an open-sourced software licensed under the MIT license.

About

Code quality insights for PHP projects/libraries

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%