larastan

Discover bugs in your code without running it - phpstan wrapper for Laravel.

Github星跟踪图


⚗️ 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/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://github.com/phpstan/phpstan

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

?? 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.

主要指标

概览
名称与所有者larastan/larastan
主编程语言PHP
编程语言PHP (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2018-06-29 20:07:07
推送于2025-04-23 09:40:16
最后一次提交
发布数166
最新版本名称v3.4.0 (发布于 )
第一版名称v0.1.0 (发布于 )
用户参与
星数5.9k
关注者数49
派生数451
提交数1.8k
已启用问题?
问题数1094
打开的问题数52
拉请求数759
打开的拉请求数25
关闭的拉请求数231
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?