nunomaduro/phpinsights
PHP Insights is a terminal tool to analyze PHP code quality, style, architecture, and complexity. Works out of the box with Laravel (artisan insights), Symfony, Yii, Magento, and more, with built-in checks for reliability and loose coupling.
The following insights are organised in different metrics :
NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Classes <Badge text="Architecture\Classes" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Constants <Badge text="Architecture\Constants" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Files <Badge text="Architecture\Files" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Functions <Badge text="Architecture\Functions" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Interfaces <Badge text="Architecture\Interfaces" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Namespaces <Badge text="Architecture\Namespaces" type="warn" vertical="middle"/>NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Traits <Badge text="Architecture\Traits" type="warn" vertical="middle"/>This insight disallows usage of normal classes. A Class must be abstract or final.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses
This sniff ensures classes are in camel caps, and the first letter is capitalised.
Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff
This sniff checks if the declaration of the class is correct
Insight Class: PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff
This sniff checks the size of your classes/traits/interface
Insight Class: ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff
\ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff::class => [
'maxLength' => 200,
]
This sniff checks if the number of methods per class is under a limit.
Insight Class: ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff
\ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff::class => [
'maxCount' => 10,
]
This sniff checks if the number of properties per class is under a limit.
Insight Class: ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff
\ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff::class => [
'maxCount' => 10,
]
This sniff checks that only one class is declared per file.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneClassPerFileSniff
This sniff reports use of superfluous prefix or suffix "Interface" for interfaces.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousInterfaceNamingSniff
This sniff reports use of superfluous prefix or suffix "Abstract" for abstract classes.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousAbstractClassNamingSniff
globals is prohibited <Badge text="^1.0"/> <Badge text="Architecture\Constants" type="warn"/>This insight disallows defining globals.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineGlobalConstants
This sniff reports use of superfluous prefix or suffix "Exception" for exceptions.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousExceptionNamingSniff
This sniff checks the size of functions
Insight Class v1.0: ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff
\ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff::class => [
'maxLength' => 20,
]
Insight Class v2.0: SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff
\SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class => [
'maxLinesLength' => 20,
]
This sniff checks that only one interface is declared per file.
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneInterfacePerFileSniff
This sniff enforces one space after namespace, disallows content between namespace name and semicolon and disallows use of bracketed syntax.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\NamespaceDeclarationSniff
This sniff looks for use alias that is the same as the unqualified name.
Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UselessAliasSniff
This sniff verifies that compound namespaces are not defined too deep.
Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Namespaces\CompoundNamespaceDepthSniff
This insight disallows trait usage.
Insight Class: NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits
This sniff checks that only one trait is declared per file
Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneTraitPerFileSniff
This sniff reports use of superfluous prefix or suffix "Trait" for traits.
Insight Class: SlevomatCodingStandard\Sniffs\Classes\SuperfluousTraitNamingSniff
In method arguments and method calls, there must not be a space before each comma and there must be one space after each comma. Argument lists may be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list must be on the next line, and there must be only one argument per line.
Insight Class: PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer
\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class => [
'after_heredoc' => false,
'ensure_fully_multiline' => false,
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ignore' // possible values ['ignore', 'ensure_single_line', 'ensure_fully_multiline']
]
How can I help you explore Laravel packages today?