
PHPStan Friendly Formatter
github.com/yamadashy/phpstan-friendly-formatter- Category
- Developer Tools
- Rank
- No. 1467Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- yamadashy
- GitHub
- 65 stars
- Latest release
- v1.4.0
- Date
About
Friendly error formatter extension for PHPStan with code snippets and color highlighting — makes static analysis output much more readable.
What it does
It plugs into PHPStan’s reporting stage and turns analysis findings into terminal output centered on the affected source. Each result can include nearby lines, syntax treatment, line numbers, grouped error identifiers, and optional links that open the location in an editor.
Why it's ranked here
This is a focused improvement with little ceremony. Composer installs it, PHPStan discovers the extension, and one setting selects it. Configurable context and editor links address common navigation friction, while compatibility across both supported PHPStan major lines makes adoption practical.
What's good
The formatter combines local source context with a summary of error identifiers and their frequencies. Teams can tune how many surrounding lines appear. Editor links support absolute or relative paths, which accommodates local development and container workflows. CI-specific formatters are also wired into the extension.
Tradeoffs
It changes presentation, not PHPStan’s analysis or the underlying findings. Syntax coloring depends on a separate console-highlighting package, although the architecture includes a plain fallback. Editor links require scheme and path configuration, with container users potentially needing a local base path. PHP versions before 8.1 are unsupported.
How to use it well
Use it in PHP projects already running PHPStan, especially when developers inspect failures interactively or in GitHub Actions. Install it as a development dependency, select the friendly output format, tune surrounding context, and configure editor links for your environment. Keep separate tools for finding defects, enforcing style, and fixing reported code.
Technical notes+
composer.json declares a PHPStan extension with PSR-4 autoloading from src/, PHP ^8.1, PHPStan ^1.0 || ^2.0, and php-console-highlighter across several major package lines. extension.neon registers Yamadashy\PhpStanFriendlyFormatter\FriendlyErrorFormatter as errorFormatter.friendly, injects relative-path helpers and CI formatters, and defines lineBefore, lineAfter, and nullable editorUrl parameters. phpstan.neon.dist analyzes src and tests at level 10. phpunit.xml discovers tests under tests and applies strict warning, risky-test, and output settings. CLAUDE.md describes a pipeline from AnalysisResult through FriendlyErrorFormatter, ErrorWriter, CodeHighlighter, and SummaryWriter to console output, including a fallback highlighter.
Observed
- License
- MIT
- Primary language
- PHP
- Packaging
- Composer package with type phpstan-extension and PSR-4 autoloading
- Install surface
- Development dependency installed through Composer
- Interface
- PHPStan error formatter selected through PHPStan configuration or its CLI error-format option
- Runtime support
- PHP 8.1 or newer, with PHPStan 1.x or 2.x
- Test structure
- PHPUnit is configured to discover a tests directory and measure coverage for src
Read from README.md, composer.json, CLAUDE.md, LICENSE.md, .typos.toml, phpunit.xml, .tool-versions, extension.neon, phpstan.neon.dist, .php-cs-fixer.dist.php, .github/dependabot.yml, .github/renovate.json5, playground/phpstan.neon, .devcontainer/Dockerfile, playground/baseline.neon.
What it can do
Format PHPStan error output with improved readability
Raw PHPStan static analysis error output → Formatted error messages with enhanced visual presentation
Add code snippets to error messages
PHPStan error reports → Error messages with relevant code context snippets
Apply color highlighting to static analysis output
Plain text PHPStan error messages → Color-highlighted error messages
Transform static analysis results into user-friendly format
PHPStan analysis results → Human-readable formatted analysis reports
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.