Larastan: Discover Bugs in Your Code Before Running It

Larastan is a static analysis command-line tool by Nuno Maduro built on top of PHPStan and focuses on finding errors in your Laravel code before running it. If youve ever used PhpStorm, youve probably experienced static analysis of your PHP code both in realtime and within code inspections. Laravel takes advantage of PHPs magic methods (i.e., __get()) for some of the framework functionality, and Larastan aims to analyze code that relies on magic methods and report any possible bugs. Once you install Larastan with Composer, you can use the projects Artisan command on Laravel applications: The code:analyse command has a few flags that will help you customize the analysis: You can also use Larastan to analyze code for Laravel packages, with a phpstan.neon.dist configuration file in the root of your package: Read Full Article at