Larastan v1.0 Released | Laravel News
After initially writing about Larastan back in 2018, we are pleased to see the release of Larastan v1.0 this week, a package to help analyze Laravel application code:
After almost 6 million downloads, Larastan v1 is finally out! Thank you, @can__vural — Larastan co-author — for making this possible. https://t.co/zle9P29QQT
— Nuno Maduro (@enunomaduro) November 1, 2021
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:
1composer require nunomaduro/larastan --with-dependencies --dev
3# after setting up a `phpstan.neon` file in the root
4# of your project, you can analyze your code:
If you find this package useful, consider sponsoring the developers Nuno Maduro and Can Vural on GitHub. The Larastan project page has links to all the ways you can sponsor their work.
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.
You can see the complete list of new features and updates below and the diff between v0.7.15 and v1.0.0. Also, the following release notes are directly from the changelog:
- 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
- PHPStan 1.0 compatibility in #968
Credit: Source link