PHPackages                             yamadashy/phpstan-friendly-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. yamadashy/phpstan-friendly-formatter

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

yamadashy/phpstan-friendly-formatter
====================================

Simple error formatter for PHPStan that display code frame

v1.4.0(3mo ago)64573.8k↓22.5%5[1 issues](https://github.com/yamadashy/phpstan-friendly-formatter/issues)20MITPHPPHP ^8.1CI passing

Since May 16Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/yamadashy/phpstan-friendly-formatter)[ Packagist](https://packagist.org/packages/yamadashy/phpstan-friendly-formatter)[ RSS](/packages/yamadashy-phpstan-friendly-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (21)Used By (20)

🤝 PHPStan Friendly Formatter
============================

[](#-phpstan-friendly-formatter)

[![Downloads](https://camo.githubusercontent.com/a7557aa89f7a8f9903cfdef98d693e47f2480288231bf9b47a19a3c459d9e5ad/68747470733a2f2f736869656c64732e696f2f7061636b61676973742f64742f79616d6164617368792f7068707374616e2d667269656e646c792d666f726d6174746572)](https://packagist.org/packages/yamadashy/phpstan-friendly-formatter)[![Test Status](https://camo.githubusercontent.com/35ad8749c91d110ce700572f31cc611083912ccda446e2ab142f0d7ca09c460a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f79616d6164617368792f7068707374616e2d667269656e646c792d666f726d61747465722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473266c6f676f3d676974687562)](https://github.com/yamadashy/phpstan-friendly-formatter/actions)[![Latest Version](https://camo.githubusercontent.com/d41ae605dbeaf77c38c54df184abeab989d36dce16228bdfa8707021df699ba9/68747470733a2f2f706f7365722e707567782e6f72672f79616d6164617368792f7068707374616e2d667269656e646c792d666f726d61747465722f762f737461626c652e737667)](https://packagist.org/packages/yamadashy/phpstan-friendly-formatter)[![License](https://camo.githubusercontent.com/c5c65c5504c0706dbd441489d4098ea73c39ec6e91acaf962972bd7c614123a4/68747470733a2f2f706f7365722e707567782e6f72672f79616d6164617368792f7068707374616e2d667269656e646c792d666f726d61747465722f6c6963656e73652e737667)](https://github.com/yamadashy/phpstan-friendly-formatter/blob/master/LICENSE.md)

Enhance your [PHPStan](https://phpstan.org/) experience with a formatter that brings your code to life! 🚀

🌟 Features
----------

[](#-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](./docs/example.png)](./docs/example.png)

🎯 Motivation
------------

[](#-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
-----------------

[](#-getting-started)

1. You may use [Composer](https://getcomposer.org/) to install this package as a development dependency.

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

2. Register error formatter into your `phpstan.neon` or `phpstan.neon.dist`:

```
includes:
    - ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
```

3. Finally, set the `errorFormat` parameter:

```
parameters:
    errorFormat: friendly
```

### Optional: Simplify Your Workflow

[](#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
------------------------

[](#️-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

[](#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
----------

[](#️-example)

When you actually introduce it in GitHub Actions, it will be displayed as follows.

[![PHPStan Friendly Formatter output in GitHub Actions](./docs/github-actions.png)](./docs/github-actions.png)

🛠️ Development
--------------

[](#️-development)

```
composer test          # Run tests
composer cs-fix        # Fix code style
composer playground    # Test formatter output with sample errors
```

📜 License
---------

[](#-license)

Distributed under the [MIT license](LICENSE.md).

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity51

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~140 days

Recently: every ~123 days

Total

8

Last Release

113d ago

PHP version history (3 changes)v1.0.0PHP ^7.2 || ^8.0

v1.2.0PHP ^7.4 || ^8.0

v1.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/aacc008bb6778a751e864cd6ab7e7a55374d90d60ffea6e58b2148d8db807a1c?d=identicon)[yamadashy](/maintainers/yamadashy)

---

Top Contributors

[![yamadashy](https://avatars.githubusercontent.com/u/5019072?v=4)](https://github.com/yamadashy "yamadashy (80 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (9 commits)")[![MatuzMark](https://avatars.githubusercontent.com/u/132094691?v=4)](https://github.com/MatuzMark "MatuzMark (4 commits)")[![jdreesen](https://avatars.githubusercontent.com/u/424602?v=4)](https://github.com/jdreesen "jdreesen (3 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (2 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (1 commits)")[![marcreichel](https://avatars.githubusercontent.com/u/7645035?v=4)](https://github.com/marcreichel "marcreichel (1 commits)")

---

Tags

code-qualitydeveloper-toolsphpphp8phpstanphpstan-extensionstatic-analysisstatic-code-analysistestingphpPHPStanstatic analysispackage

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yamadashy-phpstan-friendly-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/yamadashy-phpstan-friendly-formatter/health.svg)](https://phpackages.com/packages/yamadashy-phpstan-friendly-formatter)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[ekino/phpstan-banned-code

Detected banned code using PHPStan

2925.6M92](/packages/ekino-phpstan-banned-code)[shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.

3462.2M52](/packages/shipmonk-dead-code-detector)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3287.8M898](/packages/szepeviktor-phpstan-wordpress)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

1484.6k3](/packages/calebdw-larastan)[shipmonk/phpstan-rules

Various extra strict PHPStan rules we found useful in ShipMonk.

1491.7M114](/packages/shipmonk-phpstan-rules)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
