Jun 30, 2020 by Thibault Debatty | 3632 views
In a previous blog post we presented PHPStan, a static code analyzer for PHP. If you are developing a Laravel application, you can of course use PHPStan to validate your code. However, Laravel has a lot of subtleties and auto-magic that make static code analysis challenging. This is where Larastan comes into play: a wrapper around PHPStan that adds support specifically for Laravel.
As usual, with composer:
composer require --dev nunomaduro/larastan
Then you have to create a configuration file called phpstan.neon :
This file uses neon syntax, which is actually pretty similar to yaml.
You are now all set to use phpstan for your Laravel project.
There is a lot that can be configured in PHPStan. You can find all details in our previous blog post on PHPStan.
This blog post is licensed under CC BY-SA 4.0