magdy-hakam / larastan
Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:phpstan-extension
Requires
- php: ^7.2||^8.0
- ext-json: *
- composer/composer: ^1.0 || ^2.0
- illuminate/console: ^6.0 || ^7.0
- illuminate/container: ^6.0 || ^7.0
- illuminate/contracts: ^6.0 || ^7.0
- illuminate/database: ^6.0 || ^7.0
- illuminate/http: ^6.0 || ^7.0
- illuminate/pipeline: ^6.0 || ^7.0
- illuminate/support: ^6.0 || ^7.0
- mockery/mockery: ^0.9 || ^1.0
- phpstan/phpstan: ^0.12.23
- symfony/process: ^4.3 || ^5.0
Requires (Dev)
- orchestra/testbench: ^4.0 || ^5.0
- phpunit/phpunit: ^7.3 || ^8.2
Suggests
- orchestra/testbench: ^4.0 || ^5.0
This package is not auto-updated.
Last update: 2025-03-04 16:57:02 UTC
README
⚗️ About Larastan
Larastan was created by Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural and Viktor Szépe, and is a PHPStan wrapper for Laravel. Larastan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you 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
✨ Getting Started in 3 Steps
Requires:
1: First, you may use Composer to install Larastan as a development dependency into your Laravel project:
composer require --dev nunomaduro/larastan
Using Larastan for analysing Laravel packages? You may need to install
orchestra/testbench
.
2: Then, create a phpstan.neon
or phpstan.neon.dist
file in the root of your application. It might look like this:
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app
# The level 8 is the highest level
level: 5
ignoreErrors:
- '#Unsafe usage of new static#'
excludes_analyse:
- ./*/*/FileToBeExcluded.php
checkMissingIterableValueType: false
For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference
3: Finally, you may start analyzing your code using the phpstan console command:
./vendor/bin/phpstan analyse
If you are getting the error Allowed memory size exhausted
, then you can use the --memory-limit
option fix the problem:
./vendor/bin/phpstan analyse --memory-limit=2G
Rules
A list of configurable rules specific to Laravel can be found here.
👊🏻 Contributing
Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.
You can have a look at the CHANGELOG for constant updates & detailed information about the changes. You can also follow the Twitter account for the latest announcements or just come say hi!: @enunomaduro.
❤️ Support the development
Do you like this project? Support it by donating
📖 License
Larastan is an open-sourced software licensed under the MIT license.