yamadashy/phpstan-friendly-formatter
Composer 安装命令:
composer require --dev yamadashy/phpstan-friendly-formatter
包简介
Simple error formatter for PHPStan that display code frame
README 文档
README
Enhance your PHPStan experience with a formatter that brings your code to life! 🚀
🌟 Features
- Display Code Frame: See the problematic code right where the error occurs
- Error Identifier Summary: Get a quick overview of error types and their frequencies
- Beautiful Output: Enjoy a visually appealing and easy-to-read error report
🎯 Motivation
Ever felt lost in a sea of file paths and line numbers? We've been there! That's why we created this formatter to:
- Instantly pinpoint what's wrong in your code
- Reduce mental overhead when interpreting error messages
- Accelerate your debugging process
🚀 Getting Started
- You may use Composer to install this package as a development dependency.
composer require --dev yamadashy/phpstan-friendly-formatter
- Register error formatter into your
phpstan.neonorphpstan.neon.dist:
includes: - ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
- Finally, set the
errorFormatparameter:
parameters: errorFormat: friendly
Optional: Simplify Your Workflow
If you want to make it simpler, setting scripts in composer.json as follows:
{
"scripts": {
"analyze": "phpstan analyze --error-format friendly"
}
}
You can run a short command like this:
composer analyze
⚙️ Configuration Options
You can customize in your phpstan.neon:
parameters: friendly: lineBefore: 3 # Number of lines to display before error line (default: 2) lineAfter: 3 # Number of lines to display after error line (default: 2) editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' # Editor URL (default: null)
Editor URL Configuration
The editorUrl option allows you to create clickable links in terminal output that open files directly in your editor.
Available placeholders:
%%file%%- Absolute file path%%relFile%%- Relative file path (useful for Docker/container environments)%%line%%- Line number
Editor examples:
parameters: friendly: # PhpStorm / IntelliJ IDEA editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' # VSCode (with absolute path) editorUrl: 'vscode://file/%%file%%:%%line%%' # VSCode (with relative path - for Docker environments, requires base path) editorUrl: 'vscode://file//your/local/project/path/%%relFile%%:%%line%%' # Sublime Text editorUrl: 'subl://open?url=file://%%file%%&line=%%line%%'
Note: When running PHPStan in Docker or other virtualized environments, use
%%relFile%%instead of%%file%%to get the relative path. For VSCode, you may need to prepend your local project path since VSCode requires absolute paths.
🖼️ Example
When you actually introduce it in GitHub Actions, it will be displayed as follows.
https://github.com/yamadashy/laravel-blade-minify-directive/actions/runs/4714024802/jobs/8360104870
🛠️ Development
composer test # Run tests composer cs-fix # Fix code style composer playground # Test formatter output with sample errors
📜 License
Distributed under the MIT license.
yamadashy/phpstan-friendly-formatter 适用场景与选型建议
yamadashy/phpstan-friendly-formatter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 762.82k 次下载、GitHub Stars 达 64, 最近一次更新时间为 2023 年 06 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「php」 「static analysis」 「PHPStan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yamadashy/phpstan-friendly-formatter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yamadashy/phpstan-friendly-formatter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yamadashy/phpstan-friendly-formatter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
TwigStan is a static analyzer for Twig templates powered by PHPStan
Simple ASCII output of array data
Arc5 provides a set of static classes for the Mvc5 Framework
Zend Expressive adapter for rwoverdijk/assetmanager
统计信息
- 总下载量: 762.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 64
- 点击次数: 21
- 依赖项目数: 23
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-19
