PHPackages                             nicksdot/phpstan-prettier-output - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nicksdot/phpstan-prettier-output

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nicksdot/phpstan-prettier-output
================================

Custom PHPStan formatters for a prettier output.

0.3.0(1y ago)030MITPHPPHP &gt;=8.3

Since Aug 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/NickSdot/phpstan-prettier-output)[ Packagist](https://packagist.org/packages/nicksdot/phpstan-prettier-output)[ RSS](/packages/nicksdot-phpstan-prettier-output/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

More Readable PHPStan Output
============================

[](#more-readable-phpstan-output)

Important
---------

[](#important)

This is a proof of concept. Things are rough, hacky and not cleaned up. However, it works.

Installation
------------

[](#installation)

```
$ composer require --dev nicksdot/phpstan-prettier-output
```

**Setup Formatters**

```
services:
+	errorFormatter.customTable:
+		class: NickSdot\PrettierStanOutput\CustomTableFormatter
+	errorFormatter.customJson:
+		class: NickSdot\PrettierStanOutput\CustomJsonFormatter
+	errorFormatter.customCheckstyle:
+		class: NickSdot\PrettierStanOutput\CustomCheckstyleFormatter
```

**IDE Output**

If you also want prettier messages in your IDE you must override the default `CheckstyleErrorFormatter`. To do this, override the service in your `phpstan.non`.

```
services:
	errorFormatter.customTable:
		class: NickSdot\PrettierStanOutput\CustomTableFormatter
	errorFormatter.customJson:
		class: NickSdot\PrettierStanOutput\CustomJsonFormatter
	errorFormatter.customCheckstyle:
		class: NickSdot\PrettierStanOutput\CustomCheckstyleFormatter
+	errorFormatter.checkstyle:
+		class: NickSdot\PrettierStanOutput\CustomCheckstyleFormatter
```

Wishlist
--------

[](#wishlist)

To make this package less hacky, we would need the following.

**PHPStorm PHPStan Plugin**

- allow custom formatter in settings
- allow line breaks in tooltip output.
- adjust processing and consumption of `PhpStanMessageProcessor`.java so that inspection tooltips and inspection the inspections message window use different messages. Similar to how it already works in the HTML inspection.

Plugin repo:

**PHPStan**

Currently, we rely on Regex to re-format the reported messages (e.g. adding line-breaks). It would be nice, but it is no deal-breaker if not, if PHPStan would add support for formatted messages.

Possible approaches:

- keep track of all non `sprintf`'ed messages in a static property (?) of `RuleErrorBuilder::message()`.
- make it a first class feature to have a formatted and unformatted variant of messages.
- add values required to build messages to `PHPStan\Command\AnalysisResult`.

Considerations
--------------

[](#considerations)

**Usage of "Tips"**

Ondrej [recommended the sole usage of "tips" output](https://github.com/phpstan/phpstan/discussions/11476#discussioncomment-10274315). However, this seems not sufficient for the following reasons.

- More often than not there are no "tips".
- There can be multiple tips per error.
- They are often simply external references like in the following example.

```
12   app/Models/Option.php:12
PHPDoc type array of property App\Models\Option::$fillable is not the same as PHPDoc type list of overridden property Illuminate\Database\Eloquent\Model::$fillable.

💡 You can fix 3rd party PHPDoc types with stub files:
💡 https://phpstan.org/user-guide/stub-files

```

Given this example, the solution proposed by Ondrej would result in the following which is not much more readable and has the same cognitive load than before.

[![](.github/img/ondrej-tips-usage-proposal.png)](.github/img/ondrej-tips-usage-proposal.png)

Using the approach from this repository, the output will result in.

```
12   app/Models/Option.php:12
PHPDoc type of property App\Models\Option::$fillable is not the same as PHPDoc type of overridden property Illuminate\Database\Eloquent\Model::$fillable.

⁉️ array
⁉️ list

💡 You can fix 3rd party PHPDoc types with stub files:
💡 https://phpstan.org/user-guide/stub-files

```

So the current conclusion is, tips are **not** the way.

Credits
-------

[](#credits)

All formatters are based on the [PHPStan built-in ErrorFormatters](https://phpstan.org/user-guide/output-format).

Contributing
------------

[](#contributing)

- [Issue Tracker](https://github.com/NickSdot/phpstan-prettier-output/issues)
- [Merge Request ](https://github.com/NickSdot/phpstan-prettier-output/pull)

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~31 days

Total

4

Last Release

552d ago

PHP version history (2 changes)v0.1.0PHP &gt;=8.0

0.2.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/3162c42d78f1ecd8d4d97f372566c6ad7728306b9743a5861c61650f24c8b3fc?d=identicon)[NickSdot](/maintainers/NickSdot)

---

Top Contributors

[![NickSdot](https://avatars.githubusercontent.com/u/32384907?v=4)](https://github.com/NickSdot "NickSdot (7 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nicksdot-phpstan-prettier-output/health.svg)

```
[![Health](https://phpackages.com/badges/nicksdot-phpstan-prettier-output/health.svg)](https://phpackages.com/packages/nicksdot-phpstan-prettier-output)
```

###  Alternatives

[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87578.8k35](/packages/ticketswap-phpstan-error-formatter)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[johnbillion/wp-compat

PHPStan extension to help verify that your PHP code is compatible with a given version of WordPress

24115.0k10](/packages/johnbillion-wp-compat)

PHPackages © 2026

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