Pint is a package for formatting the code according to Laravel standards.
composer require laravel/pint --dev
./vendor/bin/pint
PHP Insights: Code analysis for PHP/Laravel
composer require nunomaduro/phpinsights --dev
php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider"
php artisan insights
Larastan finds errors
composer require nunomaduro/larastan:^2.0 --dev
phpstan.neon
or phpstan.neon.dist
file in the root of your application
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app/
# Level 9 is the highest level
level: 5
./vendor/bin/phpstan analyse --memory-limit=2G
Tlint is an opinionated code linter.
composer global require tightenco/tlint
tlint format
# option A
$value = 'Hello, World!';
return view('view', compact('value'));
# option B
return view('view', ['value' => 'Hello, World!']);
# option C
return view('view')
->with('value', 'Hello, World!');
"scripts": {
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=2G",
"insights": "@php artisan insights --no-interaction --fix -v",
"pint": "vendor/bin/pint",
"tlint": "tlint format"
"analyse": [
"@pint",
"@insights",
"@phpstan",
"@tlint"
]
},
composer analyse