calebdw / larastan
Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel
Package info
Type:phpstan-extension
pkg:composer/calebdw/larastan
Fund package maintenance!
Requires
- php: ^8.2
- ext-json: *
- illuminate/console: ^11.44.2 || ^12.4.1 || ^13
- illuminate/container: ^11.44.2 || ^12.4.1 || ^13
- illuminate/contracts: ^11.44.2 || ^12.4.1 || ^13
- illuminate/database: ^11.44.2 || ^12.4.1 || ^13
- illuminate/http: ^11.44.2 || ^12.4.1 || ^13
- illuminate/pipeline: ^11.44.2 || ^12.4.1 || ^13
- illuminate/support: ^11.44.2 || ^12.4.1 || ^13
- phpmyadmin/sql-parser: ^5.9.0
- phpstan/phpstan: ^2.2.2
Requires (Dev)
- doctrine/coding-standard: ^14.0
- laravel/framework: ^11.44.2 || ^12.4.1 || ^13
- mockery/mockery: ^1.6
- nikic/php-parser: ^5.6
- orchestra/canvas: ^v9.1.3 || ^10.0 || ^11
- orchestra/testbench-core: ^9.5.2 || ^10.0 || ^11
- phpstan/phpstan-deprecation-rules: ^2.0.1
- phpunit/phpunit: ^10.5.35 || ^11.5.15 || ^12.5.8 || ^13.1.8
Suggests
- orchestra/testbench: Using Larastan for analysing a package needs Testbench
Replaces
- larastan/larastan: v3.12.3
This package is auto-updated.
Last update: 2026-08-24 06:12:55 UTC
README
Important
This fork has moved to calebdw/phpstan-laravel.
The work here outgrew what a fork could carry. Living downstream of Larastan meant every change had to stay compatible with it, which ruled out renaming confusing options, dropping old version shims, or reorganising anything. phpstan-laravel is the same work as its own package, free to make those decisions, with documentation to match.
composer remove --dev calebdw/larastan composer require --dev calebdw/phpstan-laravel
The migration guide covers the rest: options now nest under
laravel:, error identifiers are prefixed laravel. instead of larastan.,
and a few names changed to say what they actually do.
This fork is no longer maintained and will not be updated.
⚗️ About This Fork
Hello! 👋
This was my fork of larastan/larastan, carrying features and improvements that had been proposed upstream but were not yet available there. It existed to give the community immediate access to those enhancements while staying compatible with the upstream package.
Tip
For Laravel Livewire support, check out larastan-livewire!
🔄 Changes and Upstream PRs
This fork includes the following changes and enhancements:
- fix: conditionable calls on relations
- fix: mark macro methods as static only if the closure is static
- feat: add support for Collection, Builder, and Arr pluck
- fix: self::query() for final models
- feat: add optional noModelForwardingToBuilder and noModelStaticForwardingToBuilder
- fix: factory {has,for}* methods should return static
- fix: property type for uuid and ulid primary keys
- fix: collection template types being overwritten
- fix: builder stubs and builder/model forwarding
- fix: handle collection intersection types
- feat: support dynamic relation closures
- feat: add support for config array shapes
- feat: support multiple database connections
- feat: support wildcards in migration/schema paths
- fix: default date casting
- fix: make TGet covariant on Attribute stub
✨ Getting Started
To use this fork, you may use Composer to install it as a development dependency into your Laravel project:
composer require --dev "calebdw/larastan:^3.0"
Or if you already have the upstream package installed, you can point your composer.json to this fork:
- "larastan/larastan": "^3.0" + "calebdw/larastan": "^3.0"
If you have the PHPStan extension installer installed then nothing more is needed, otherwise you will need to manually include the extension in the phpstan.neon(.dist) configuration file:
includes: - ./vendor/calebdw/larastan/extension.neon
For more information on how to configure and use Larastan, please refer to the official documentation.
👊🏻 Contributing
Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.
📄 License
This fork is open-sourced software licensed under the MIT license.

