Skip to main content
Back to packages
6,404 GitHub stars

nunomaduro/larastan

View on GitHub

Description

Adds code analysis to Laravel improving developer productivity and code quality

Create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

includes:
- vendor/larastan/larastan/extension.neon
- vendor/nesbot/carbon/extension.neon
 
parameters:
 
paths:
- app/
 
# Level 10 is the highest level
level: 5
 
# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php

For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference

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

Related Content on Laravel Daily

Video

Recent Courses on Laravel Daily

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.