Analyze code quality with Laravel PHP Insights

Tram Ho

1.Introduction

PHP Insights is a perfect tool to check and analyze the code quality of your PHP projects, easy to install and has pure PHP support.

You can learn more here: https://phpinsights.com/

2.Start

PHP version

  • PHP version: PHP 7.2+

Install

  • composer require nunomaduro/phpinsights --dev
  • publish config-file: php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider"

Run

  • php artisan insights
  • By default, only the first three issues are displayed, but with the -v option, all of them are displayed. php artisan insights -v

Evaluation items

  • Items rated: Code, Complexity, Architecture, Style
  • Rating scale: 1 to 100 points, Red: 1-49, Yellow: 50-79, Green: 80-100
  • Do your best and aim for the green

Demo

If the result is like this, your project is great!

3. Conclusion

With PHP Insights it can show you various problems like: unused variables, brackets,  Todo, … it also detects if there is a security problem with your library, very easy to install , so give it a try if you like

Sincerely, goodbye, determined to win the epidemic!

Share the news now