Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpinsights Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Style

All insights about style are regrouped in one Metric:

  • NunoMaduro\PhpInsights\Domain\Metrics\Style\Style <Badge text="Style" type="warn" vertical="middle"/>

Closing tag <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that the file does not end with a closing tag.

Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\ClosingTagSniff

End file newline <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures the file ends with a newline character.

Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\EndFileNewlineSniff

Side effects <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures a file declares new symbols and causes no other side effects, or executes logic with side effects, but not both.

Insight Class: PHP_CodeSniffer\Standards\PSR1\Sniffs\Files\SideEffectsSniff

Git merge conflict <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks for merge conflict artifacts.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\GitMergeConflictSniff

Byte order mark <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff detects BOMs that may corrupt application work.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff

Line endings <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff checks that end of line characters are correct.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineEndingsSniff

\PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineEndingsSniff::class => [
    'eolChar' => '\n',
]

Function closing brace <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that the closing brace of a function goes directly after the body.

Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionClosingBraceSniff

Object operator indent <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff checks that object operators are indented correctly.

Insight Class: PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ObjectOperatorIndentSniff

\PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ObjectOperatorIndentSniff::class => [
    'indent' => 4,
]

Scope closing brace <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff checks that the closing braces of scopes are aligned correctly.

Insight Class: PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ScopeClosingBraceSniff

\PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ScopeClosingBraceSniff::class => [
    'indent' => 4,
]

Disallow long array syntax <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff bans the use of the PHP long array syntax (array()). Use [] instead.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\DisallowLongArraySyntaxSniff

Line length <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff checks the length of all lines in a file.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff

\PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff::class => [
    'lineLimit' => 80,
    'absoluteLineLimit' => 100,
    'ignoreComments' => false,
]

Space after cast <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures there is a single space after cast tokens.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff

Space after not <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures there is a single space after a NOT operator.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff

Function call argument spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that calls to methods and functions are spaced correctly.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\FunctionCallArgumentSpacingSniff

Character before PHP opening tag <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that the opening PHP tag is the first content in a file.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff

Backtick Operator <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff disallows the use of the backtick execution operator.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\BacktickOperatorSniff

Disallow alternative PHP tags <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff verifies that no alternative PHP tags are used.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowAlternativePHPTagsSniff

Disallow short open tag <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff makes sure that shorthand PHP open tags are not used.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowShortOpenTagSniff

Lower case constant <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that all uses of true, false and null are lowercase.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseConstantSniff

Lower case keyword <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that all PHP keywords are lowercase.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseKeywordSniff

Lower case type <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks that all PHP types are lowercase.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseTypeSniff

SAPI Usage <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures the PHP_SAPI constant is used instead of php_sapi_name().

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\SAPIUsageSniff

Syntax <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="Deprecated since 2.0" type="error"/>

This sniff ensures PHP believes the syntax is clean.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\SyntaxSniff

Note: This sniff is deprecated, use insight below

Syntax Check <Badge text="^2.0"/> <Badge text="Style" type="warn"/>

This Insight process lint on all PHP files via php -l using PHP-Parallel-Lint.

Insight Class: NunoMaduro\PhpInsights\Domain\Insights\SyntaxCheck

Trailing array comma <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff enforces trailing commas in multi-line arrays and requires short array syntax []. Commas after the last element in an array make adding a new element easier and result in a cleaner versioning diff.

Insight Class: SlevomatCodingStandard\Sniffs\Arrays\TrailingArrayCommaSniff

Arbitrary parentheses spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks whitespace on the inside of arbitrary parentheses.

Arbitrary parentheses are those which are not owned by a function (call), array or control structure. Spacing on the outside is not checked on purpose as this would too easily conflict with other spacing rules.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ArbitraryParenthesesSpacingSniff

Disallow tab indent <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff throws errors if tabs are used for indentation.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowTabIndentSniff

Increment decrement spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff verifies spacing between variables and increment/decrement operators.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\IncrementDecrementSpacingSniff

Language construct spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures all language constructs contain a single space between themselves and their content.

Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\LanguageConstructSpacingSniff

Camel caps method name <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures method names are defined using camel case.

Insight Class: PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff

Else If declaration <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff verifies that there are no else if statements (elseif should be used instead).

Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ElseIfDeclarationSniff

Switch declaration <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff ensures all switch statements are defined correctly.

Insight Class: PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff

\PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff::class => [
    'indent' => 4,
]

Upper case constant name <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff ensures that constant names are all uppercase.

Insight Class: PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff

Alphabetically sorted uses <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks whether uses at the top of a file are alphabetically sorted. Follows natural sorting and takes edge cases with special symbols into consideration.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff

Namespace Spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff enforces configurable number of lines before and after namespace.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\NamespaceSpacingSniff

\SlevomatCodingStandard\Sniffs\Namespaces\NamespaceSpacingSniff::class => [
    'linesCountBeforeNamespace' => 1,
    'linesCountAfterNamespace' => 1,
]

Require one namespace in file <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff checks there is only one namespace in a file.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\RequireOneNamespaceInFileSniff

Unused uses <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff detects unused use in a file.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff

\SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff::class => [
    'searchAnnotations' => false,
    'ignoredAnnotationNames' => [], // case sensitive list of annotation names that the sniff should ignore (only the name is ignored, annotation content is still searched). Useful for name collisions like [@testCase](https://github.com/testCase) annotation and TestCase class.
    'ignoredAnnotations' => [], // case sensitive list of annotation names that the sniff ignore completely (both name and content are ignored). Useful for name collisions like [@group](https://github.com/group) Cache annotation and Cache class
]

Use does not start with Backslash <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff disallows leading backslash in use statement.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UseDoesNotStartWithBackslashSniff

Use spacing sniff <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff enforces a configurable number of lines before first use, after last use and between two use statements.

Insight Class: SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff

\SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff::class => [
    'linesCountBeforeFirstUse' => 1,
    'linesCountBetweenUseTypes' => 0,
    'linesCountAfterLastUse' => 1,
]

Spread operator spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff enforces a configurable number of spaces after the ... operator.

Insight Class: SlevomatCodingStandard\Sniffs\Operators\SpreadOperatorSpacingSniff

\SlevomatCodingStandard\Sniffs\Operators\SpreadOperatorSpacingSniff::class => [
    'spacesCountAfterOperator' => 0,
]

Short list <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff enforces using short form of list syntax, [...] instead of list(...).

Insight Class: SlevomatCodingStandard\Sniffs\PHP\ShortListSniff

Parameter type hint spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff

  • checks that there's a single space between a type hint and a parameter name: Foo $foo
  • checks that there's no whitespace between a nullability symbol and a type hint: ?Foo

Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSpacingSniff

Return type hint spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff enforces consistent formatting of return type hints.

Insight Class: SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff

\SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff::class => [
    'spacesCountBeforeColon' => 0,
]

Superfluous Whitespace <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff checks for unneeded whitespace.

Insight Class: PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff

\PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff::class => [
    'ignoreBlankLines' => false,
]

Doc comment spacing <Badge text="^1.0"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

This sniff enforces a configurable number of lines before first content (description or annotation), after last content (description or annotation), between description and annotations and between two different annotations types (eg. between [@param](https://github.com/param) and [@return](https://github.com/return)).

Insight Class: SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff

\SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class => [
    'linesCountBeforeFirstContent' => 0,
    'linesCountBetweenDescriptionAndAnnotations' => 1,
    'linesCountBetweenDifferentAnnotationsTypes' => 0,
    'linesCountBetweenAnnotationsGroups' => 1,
    'linesCountAfterLastContent' => 0,
    'annotationsGroups' => [],
]

Class instantiation <Badge text="^1.0"/> <Badge text="Style" type="warn"/>

This sniff verifies that classes are instantiated with parentheses.

Insight Class: PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\ClassInstantiationSniff

No trailing comma in single line array <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

This fixer removes trailing commas in list function calls.

Insight Class: PhpCsFixer\Fixer\ArrayNotation\NoTrailingCommaInSinglelineArrayFixer

No whitespace before comma in array <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

In array declarations, there MUST NOT be a whitespace before each comma.

Insight Class: PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer

\PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer::class => [
    'after_heredoc' => false, // Whether the whitespace between heredoc end and comma should be removed.
]

Braces <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

The body of each structure must be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.

Insight Class: PhpCsFixer\Fixer\Basic\BracesFixer

\PhpCsFixer\Fixer\Basic\BracesFixer::class => [
    'allow_single_line_closure' => false,
    'position_after_anonymous_constructs' => 'same', // possible values ['same', 'next']
    'position_after_control_structures' => 'same', // possible values ['same', 'next']
    'position_after_functions_and_oop_constructs' => 'same', // possible values ['same', 'next']
]

Encoding <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

PHP code must use only UTF-8 without BOM (remove BOM).

Insight Class: PhpCsFixer\Fixer\Basic\EncodingFixer

Lowercase static reference <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Class static references self, static and parent must be in lower case.

Insight Class: PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer

Magic constant casing <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Magic constants should be referred to using the correct casing.

Insight Class: PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer

Magic method casing <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Magic method definitions and calls must be using the correct casing.

Insight Class: PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer

Native function casing <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Function defined by PHP should be called using the correct casing.

Insight Class: PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer

Native function type declaration casing <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Native type hints for functions should use the correct case.

Insight Class: PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer

Cast spaces <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

A single space or none should be between cast and variable.

Insight Class: PhpCsFixer\Fixer\CastNotation\CastSpacesFixer

\PhpCsFixer\Fixer\CastNotation\CastSpacesFixer::class => [
    'space' => 'single' // possible values ['single', 'none']
]

Class definition fixer <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

Whitespace around the keywords of a class, trait or interfaces definition should be one space.

Insight Class: PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer

\PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class => [
    'multi_line_extends_each_single_line' => false,
    'single_item_single_line' => false,
    'single_line' => false,
]

No blank lines after class opening <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line.

Insight Class: PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer

No trailing whitespace in comment <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

There must be no trailing spaces inside comment or PHPDoc.

Insight Class: PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer

Switch case semicolon to colon <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

A case should be followed by a colon and not a semicolon.

Insight Class: PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer

Switch case space <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

This fixer removes extra spaces between colon and case value.

Insight Class: PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer

Function declaration <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

Spaces should be properly placed in a function declaration.

Insight Class: PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer

\PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class => [
    'closure_function_spacing' => 'one' // possible values ['one', 'none']
]

Function type hint space <Badge text="^1.10"/> <Badge text="Style" type="warn"/>

This fixer adds missing spaces between function's argument and its type hint.

Insight Class: PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer

Binary operator space <Badge text="^1.10"/> <Badge text="Style" type="warn"/> <Badge text="configurable"/>

Binary operators should be surrounded by spaces as configured.

Insight Class: PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer

\PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class => [
    'align_double_arrow' => false, // Whether to apply, remove or ignore double arrows alignment: possibles values [true, false, null]
    'align_equals' => false, // Whether to apply, remove or ignore equals alignment: possibles values [true, false, null]
    'default' => 'single_space', // default fix strategy: possibles values ['align', 'align_single_space', 'align_single_space_minimal', 'single_space', 'no_space', null]
]

Standardize not...

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport