PHPackages                             eliashaeussler/phpstan-config - 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. eliashaeussler/phpstan-config

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

eliashaeussler/phpstan-config
=============================

My personal configuration for PHPStan

4.0.0(5mo ago)2692.4k—4.6%[1 PRs](https://github.com/eliashaeussler/phpstan-config/pulls)16GPL-3.0-or-laterPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Feb 20Pushed 2mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (28)Used By (16)

PHPStan config
==============

[](#phpstan-config)

[![Coverage](https://camo.githubusercontent.com/de481bf5c6e4d6d079fcfa22a071964ca67c03673176523f5686e290e9e51f03/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c73436f7665726167652f6769746875622f656c6961736861657573736c65722f7068707374616e2d636f6e6669673f6c6f676f3d636f766572616c6c73)](https://coveralls.io/github/eliashaeussler/phpstan-config)[![CGL](https://camo.githubusercontent.com/bb5e92476103ecf33025513de486da4ac8d2c9f101d6d1d4f2f093815ebc238c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656c6961736861657573736c65722f7068707374616e2d636f6e6669672f63676c2e79616d6c3f6c6162656c3d63676c266c6f676f3d676974687562)](https://github.com/eliashaeussler/phpstan-config/actions/workflows/cgl.yaml)[![Tests](https://camo.githubusercontent.com/e6b32fddef18afb989e1fe2336733d86f97501efc468518e9230767b4952c9e2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656c6961736861657573736c65722f7068707374616e2d636f6e6669672f74657374732e79616d6c3f6c6162656c3d7465737473266c6f676f3d676974687562)](https://github.com/eliashaeussler/phpstan-config/actions/workflows/tests.yaml)[![Supported PHP Versions](https://camo.githubusercontent.com/9524c36b151bf2a5184091d2ea1974924ea89ec6c964aaee55a2114750a3a468/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f656c6961736861657573736c65722f7068707374616e2d636f6e6669672f7068703f6c6f676f3d706870)](https://packagist.org/packages/eliashaeussler/phpstan-config)

This package contains basic [PHPStan](https://phpstan.org/) config for use in my personal projects. It is not meant to be used anywhere else. I won't provide support and don't accept pull requests for this repo.

🔥 Installation
--------------

[](#-installation)

[![Packagist](https://camo.githubusercontent.com/2dbfb4583e127588994eca3e2e114203507e40843e99d4d11a1783d5aa60d981/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6961736861657573736c65722f7068707374616e2d636f6e6669673f6c6162656c3d76657273696f6e266c6f676f3d7061636b6167697374)](https://packagist.org/packages/eliashaeussler/phpstan-config)[![Packagist Downloads](https://camo.githubusercontent.com/9109edc1eeff86aae5a1171031005a7aac44a5854fd3fcda4701888332fc7167/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6961736861657573736c65722f7068707374616e2d636f6e6669673f636f6c6f723d627269676874677265656e)](https://packagist.org/packages/eliashaeussler/phpstan-config)

```
composer require eliashaeussler/phpstan-config
```

⚡ Usage
-------

[](#-usage)

### With extension installer

[](#with-extension-installer)

If you have the [`phpstan/extension-installer`](https://github.com/phpstan/extension-installer)package installed, there's nothing more to do. The [base configuration](extension.neon)is automatically included.

### Manual include

[](#manual-include)

Create a `phpstan.neon` file and include the [`phpstan.neon.dist`](phpstan.neon.dist) file:

```
# phpstan.neon

includes:
  - %rootDir%/../../eliashaeussler/phpstan-config/phpstan.neon.dist
```

### PHP API

[](#php-api)

The package provides a PHP configuration API for PHPStan. Add this to your `phpstan.php` file:

```
// phpstan.php

use EliasHaeussler\PHPStanConfig;

$config = PHPStanConfig\Config\Config::create(__DIR__)->in(
    'src',
    'tests',
);

// Exclude specific paths
$config->not(
    'src/lib/*',
    'tests/test-application/vendor/*',
);

// Configure rule level
$config->level(9);
$config->maxLevel();

// Enable bleeding edge
$config->withBleedingEdge();

// Include baseline file
$config->withBaseline();

// Include additional config files
$config->with(
    'phpstan-custom-rules.neon',
    'vendor/foo/baz/optional-phpstan-rules.neon',
);

// Define bootstrap files
$config->bootstrapFiles(
    'tests/build/phpstan-bootstrap.php',
);

// Define stub files
$config->stubFiles(
    'tests/stubs/ThirdPartyClass.stub',
    'tests/stubs/AnotherStubFile.stub',
);

// Override cache path
$config->useCacheDir('var/cache/phpstan');

// Ignore errors
$config->ignoreError('Access to constant EXTENSIONS on an unknown class PHPStan\ExtensionInstaller\GeneratedConfig.');
$config->ignoreError('#^Access to constant EXTENSIONS on an unknown class .+\\.$#');

// Configure unmatched error reporting
$config->reportUnmatchedIgnoredErrors(false);

// Define error formatter
$config->formatAs(PHPStanConfig\Enums\ErrorFormat::Json);

// Treat phpdoc types as certain
$config->treatPhpDocTypesAsCertain();

// Enable or disable custom rules (see rules below)
$config->useCustomRule('ignoreAnnotationWithoutErrorIdentifier', false);

// Include Doctrine set
$config->withSet(
    static function (PHPStanConfig\Set\DoctrineSet $set): void {
        $set->withObjectManagerLoader('tests/object-manager.php');
        $set->withOrmRepositoryClass(\MyApp\Doctrine\BetterEntityRepository::class);
        $set->withOdmRepositoryClass(\MyApp\Doctrine\BetterDocumentRepository::class);
    },
);

// Include Symfony set
$config->withSet(
    static function (PHPStanConfig\Set\SymfonySet $set): void {
        $set->withConsoleApplicationLoader('tests/build/console-application.php');
        $set->withContainerXmlPath('var/cache/test-container.xml');
        $set->disableConstantHassers();
    },
);

// Include TYPO3 set
$typo3Set = PHPStanConfig\Set\TYPO3Set::create()
    ->withCustomAspect('myCustomAspect', \FlowdGmbh\MyProject\Context\MyCustomAspect::class)
    ->withCustomRequestAttribute('myAttribute', \FlowdGmbh\MyProject\Http\MyAttribute::class)
    ->withCustomSiteAttribute('myArrayAttribute', 'array');
$config->withSets($typo3Set);

// Set custom parameters
$config->parameters->set('tipsOfTheDay', false);

return $config->toArray();
```

🔎 Rules
-------

[](#-rules)

The packages also provides some additional PHPStan rules. All rules are enabled by default.

### [`IgnoreAnnotationWithoutErrorIdentifierRule`](src/Rule/IgnoreAnnotationWithoutErrorIdentifierRule.php)

[](#ignoreannotationwithouterroridentifierrule)

A custom rule to report too loose ignore annotations that don't specify an error identifier. By default, both `@phpstan-ignore-line` and `@phpstan-ignore-next-line` annotations are monitored.

```
parameters:
    ignoreAnnotationWithoutErrorIdentifier:
        # Enable or disable this rule
        enabled: true
        # Define monitored annotations (without "@" prefix)
        monitoredAnnotations:
            - phpstan-ignore-line
            - phpstan-ignore-next-line
```

This rule can also be customized using the PHP API:

```
# phpstan.php

use EliasHaeussler\PHPStanConfig;

$config = PHPStanConfig\Config\Config::create(__DIR__);
$config->parameters->set('ignoreAnnotationWithoutErrorIdentifier/enabled', false);
$config->parameters->set('ignoreAnnotationWithoutErrorIdentifier/monitoredAnnotations', [
    // These annotations don't actually exist, this is just for demonstration purposes
    'phpstan-ignore-start',
    'phpstan-ignore-end',
]);

return $config->toArray();
```

⭐ License
---------

[](#-license)

This project is licensed under [GNU General Public License 3.0 (or later)](LICENSE).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance81

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 75.9% 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 ~44 days

Recently: every ~5 days

Total

24

Last Release

161d ago

Major Versions

1.1.0 → 2.0.02023-05-28

2.10.0 → 3.0.02025-11-20

3.1.2 → 4.0.02025-12-09

PHP version history (5 changes)1.1.0PHP ~8.1.0 || ~8.2.0

2.3.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

2.5.2PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

2.10.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

3.0.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/144cefe55242b883c87cb537463f3ba75a0f8198fc5b602b50c838aae31fe7ee?d=identicon)[eliashaeussler](/maintainers/eliashaeussler)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (498 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (158 commits)")

---

Tags

configphpstan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eliashaeussler-phpstan-config/health.svg)

```
[![Health](https://phpackages.com/badges/eliashaeussler-phpstan-config/health.svg)](https://phpackages.com/packages/eliashaeussler-phpstan-config)
```

###  Alternatives

[wp-cli/wp-cli-tests

WP-CLI testing framework

422.7M87](/packages/wp-cli-wp-cli-tests)[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87578.8k35](/packages/ticketswap-phpstan-error-formatter)[worksome/coding-style

Worksomes coding style

49771.7k57](/packages/worksome-coding-style)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

38244.6k16](/packages/ec-europa-toolkit)

PHPackages © 2026

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