yamadashy/phpstan-friendly-formatter
yamadashy/phpstan-friendly-formatter has 66 GitHub stars and 5 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 19:02 UTC. Last push 2026-11-15.
What you can do
- Display Code Frame: See the problematic code right where the error occurs
- Type Highlighting: In messages and tips that pair two types, the expected (declared) type is shown in green and the actual one in red. Highlighting is best-effort: unrecognized messages are printed unchanged
- 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
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
🤝 A friendly error formatter extension for PHPStan that provides more readable and informative output, including code snippets and color highlighting.
Developer ToolsREADME.md
Original🤝 PHPStan Friendly Formatter
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
- Type Highlighting: In messages and tips that pair two types, the expected (declared) type is shown in green and the actual one in red. Highlighting is best-effort: unrecognized messages are printed unchanged
- 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.