prettyyellowdog/lumenstan
Composer 安装命令:
composer require --dev prettyyellowdog/lumenstan
包简介
Lumenstan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Lumen based on Larastan
关键字:
README 文档
README
Lumenstan is a fork of Larastan specifically to maintain compatibility with Lumen. While the Lumen framework is no longer actively supported by the Laravel team, this fork is for those updating and maintaining Lumen projects already in the field.
⚗️ About Larastan
Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro and Viktor Szépe, and is a PHPStan extension for Laravel. Larastan focuses on finding errors in your code. 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
While by definition, "static analysis" doesn't load any of your application's code. Larastan boots your application's container, so it can resolve types that are only possible to compute at runtime. That's why we use the term "code analysis" instead of "static analysis".
Supported Laravel versions
| Laravel Version | Larastan Version |
|---|---|
| < 9 | 1.x |
| > 9.0 && >= 11.16 | 2.x |
| 11.16+ | 3.0+ |
Sponsors
✨ 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 "prettyyellowdog/lumenstan:^3.0"
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/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
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
Ignoring errors
Ignoring a specific error can be done either with a php comment or in the configuration file:
// @phpstan-ignore-next-line $test->badMethod(); $test->badMethod(); // @phpstan-ignore-line
When ignoring errors in PHPStan's configuration file, they are ignored by writing a regex based on error messages:
parameters: ignoreErrors: - '#Call to an undefined method .*badMethod\(\)#'
Baseline file
In older codebases it might be hard to spend the time fixing all the code to pass a high PHPStan Level.
To get around this a baseline file can be generated. The baseline file will create a configuration file with all of the current errors, so new code can be written following a higher standard than the old code. (PHPStan Docs)
./vendor/bin/phpstan analyse --generate-baseline
Rules
A list of configurable rules specific to Laravel can be found here.
Features
A list of Larastan features can be found here.
Custom PHPDoc types
A list of PHPDoc types specific to Larastan can be found here.
Custom PHPStan config parameters
A list of custom config parameters that you can use in your PHPStan config file can be found here.
Errors To Ignore
Some parts of Laravel are currently too magical for Larastan/PHPStan to understand. We listed common errors to ignore, add them as needed
👊🏻 Contributing
Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.
📖 License
Larastan is an open-sourced software licensed under the MIT license.
prettyyellowdog/lumenstan 适用场景与选型建议
prettyyellowdog/lumenstan 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 174 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「php」 「laravel」 「static analysis」 「code analysis」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 prettyyellowdog/lumenstan 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 prettyyellowdog/lumenstan 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 prettyyellowdog/lumenstan 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple ASCII output of array data
Alfabank REST API integration
Package for view storage in laravel
User Approval Laravel Package
PHPUnit Pretty Result Printer
统计信息
- 总下载量: 174
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-22


