jbelien/phpstan-sarif-formatter
Composer 安装命令:
composer require jbelien/phpstan-sarif-formatter
包简介
SARIF formatter for PHPStan
README 文档
README
🔖 Compatible with PHPStan 1.x and 2.x
PHPStan
PHPStan 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. It moves PHP closer to compiled languages in the sense that the correctness of each line of the code can be checked before you run the actual line.
Static Analysis Results Interchange Format (SARIF)
SARIF, the Static Analysis Results Interchange Format, is a standard, JSON-based format for the output of static analysis tool.
It has been approved as an OASIS standard.
SARIF is a rich format intended to meet the needs of sophisticated tools, while still being practical for use by simpler tools. Because it would be impractical to support every feature of every tool, SARIF provides an extensibility mechanism to allow tool authors to store custom data that the SARIF format doesn't directly represent.
https://docs.oasis-open.org/sarif/sarif/v2.0/sarif-v2.0.html
Usage
composer require --dev phpstan/phpstan jbelien/phpstan-sarif-formatter
Then update your phpstan.neon configuration file:
services: errorFormatter.sarif: class: PHPStanSarifErrorFormatter\SarifErrorFormatter arguments: relativePathHelper: @simpleRelativePathHelper currentWorkingDirectory: %currentWorkingDirectory% pretty: true
GitHub Code Scanning
GitHub Code Scanning features are compatible with SARIF.
The SARIF Formatter for PHPStan allows you to use PHPStan as GitHub Code Scanning tool.
To use in one of your GitHub Actions workflows, add the following in your job:
- name: Run PHPStan continue-on-error: true run: phpstan analyze --error-format=sarif > phpstan-results.sarif - name: Upload analysis results to GitHub uses: github/codeql-action/upload-sarif@v2 with: sarif_file: phpstan-results.sarif wait-for-processing: true
It will display PHPStan error messages in your PR (check this PR) and add alerts in the "Code scanning" report in "Security" tab of your project (see screenshot below).
jbelien/phpstan-sarif-formatter 适用场景与选型建议
jbelien/phpstan-sarif-formatter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 252.98k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2023 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jbelien/phpstan-sarif-formatter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jbelien/phpstan-sarif-formatter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 252.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 19
- 依赖项目数: 45
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-28
