承接 yamadashy/phpstan-friendly-formatter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yamadashy/phpstan-friendly-formatter

最新稳定版本:v1.3.0

Composer 安装命令:

composer require --dev yamadashy/phpstan-friendly-formatter

包简介

Simple error formatter for PHPStan that display code frame

README 文档

README

Downloads Test Status Latest Version License

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

PHPStan Friendly Formatter Example

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

  1. You may use Composer to install this package as a development dependency.
composer require --dev yamadashy/phpstan-friendly-formatter
  1. Register error formatter into your phpstan.neon or phpstan.neon.dist:
includes:
    - ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
  1. Finally, set the errorFormat parameter:
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.

PHPStan Friendly Formatter output in GitHub Actions https://github.com/yamadashy/laravel-blade-minify-directive/actions/runs/4714024802/jobs/8360104870

???? License

Distributed under the MIT license.

统计信息

  • 总下载量: 402.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 61
  • 点击次数: 3
  • 依赖项目数: 18
  • 推荐数: 0

GitHub 信息

  • Stars: 61
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固