nunomaduro/larastan
Larastan is a PHPStan extension for Laravel that analyzes your app to catch bugs early. It boots the container to resolve dynamic types, supports Laravel’s “magic,” and improves code quality with stronger static typing.
Code Quality & Developer Productivity:
Build vs. Buy:
Use Cases:
Level 5 failures) or warn on Level 3 issues.@var, custom Larastan types like view-string).Roadmap Enablers:
enableMigrationCache) for large codebases.phpmyadmin/sql-parser.Adopt Larastan if:
Look Elsewhere if:
*"Larastan is a force multiplier for our Laravel development team. By integrating this PHPStan extension, we can:
*"Larastan turns PHPStan into a Laravel supertool by:
Collection::where() or config() calls—it infers types dynamically.enableMigrationCache) speeds up analysis for large codebases.
Setup is simple: Install via Composer, configure phpstan.neon, and run ./vendor/bin/phpstan analyse. Start with Level 3 in CI, then ramp up to Level 5 as the team adapts."*"Think of Larastan as PHPStan on steroids for Laravel:
view-string and infers model properties from migrations.// ❌ Error: Call to undefined method Illuminate\Support\Collection::whereNotIn()
$user->posts()->whereNotIn('id', $invalidIds);
// ✅ Fixed with Larastan’s rules
$user->posts()->whereNotIn('id', $invalidIds); // Now type-checked!
Start with --level=3 in CI, then tighten the rules as you go."
How can I help you explore Laravel packages today?