Larastan is a development dependency that adds static analysis to Laravel, improving developer productivity and code quality. At the core, it’s a PHPStan wrapper for Laravel and helps you find errors in your code through static analysis. It helps catch bugs before you even write tests for the code:
- Adds static typing to Laravel to improve developer productivity and code quality
- Supports most of Laravel’s beautiful magic
- Discovers bugs in your code without running it
You can use Larastan to analyze application code as well as use it to analyze your Laravel packages.
Getting started in your new or existing Laravel project is as easy as installing the package and configuring PHPStan:
composer require nunomaduro/larastan --with-dependencies --dev # after setting up a `phpstan.neon` file in the root # of your project, you can analyze your code: ./vendor/bin/phpstan analyse
You can learn more about this package, get full installation instructions, and view the source code on GitHub. I’d recommend checking out the rules specific to Laravel applications, with configurable options.
- Dynamic method return type extension for
- New rule to check for relation existence in #985
rescuefunction now accepts the
Throwableby @sebdesign in #989
CheckJobDispatchArgumentTypesCompatibleWithClassConstructorRulerule in #991
non-empty-stringtypes in stubs. c5b81cf