PHPackages                             nowo-tech/phpstan-frankenphp - 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. [Database &amp; ORM](/categories/database)
4. /
5. nowo-tech/phpstan-frankenphp

ActivePhpstan-extension[Database &amp; ORM](/categories/database)

nowo-tech/phpstan-frankenphp
============================

PHPStan rules to migrate PHP apps from PHP-FPM to FrankenPHP classic mode, then worker mode. Rules are split by migration level with documented justification and application order.

v1.0.1(yesterday)0124↑2633.9%MITPHP &gt;=8.1 &lt;8.6

Since Jul 22Compare

[ Source](https://github.com/nowo-tech/PhpStanFrankenPhp)[ Packagist](https://packagist.org/packages/nowo-tech/phpstan-frankenphp)[ Docs](https://github.com/nowo-tech/PhpStanFrankenPhp)[ GitHub Sponsors](https://github.com/HecFranco)[ RSS](/packages/nowo-tech-phpstan-frankenphp/feed)WikiDiscussions Synced today

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

PhpStanFrankenPhp
=================

[](#phpstanfrankenphp)

[![CI](https://github.com/nowo-tech/PhpStanFrankenPhp/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/PhpStanFrankenPhp/actions/workflows/ci.yml) [![Packagist Version](https://camo.githubusercontent.com/ca9bbe1cd2cc58df017c5e61f9aa3a27ce792154143dcc7f0645437769e491d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f7068707374616e2d6672616e6b656e7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/phpstan-frankenphp) [![Packagist Downloads](https://camo.githubusercontent.com/54615aea9a30f9c3612e93ae86570f4cfc4e647695a48bc4e551a89bed7557d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f7068707374616e2d6672616e6b656e7068702e737667)](https://packagist.org/packages/nowo-tech/phpstan-frankenphp) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE) [![PHP](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://php.net) [![PHPStan](https://camo.githubusercontent.com/131d8eb82b3ef718ec31c7cc9355ca476836559621a498555e957c23acb03904/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d322e782d3446354439353f6c6f676f3d706870)](https://phpstan.org) [![GitHub stars](https://camo.githubusercontent.com/e99e62fa612bf249ef4305add4434c62935a973cb55885abb19c2ea605d55157/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f7068707374616e2d6672616e6b656e7068702e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/PhpStanFrankenPhp) [![Coverage](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)](#tests-and-coverage)

> ⭐ **Found this useful?** Install from [Packagist](https://packagist.org/packages/nowo-tech/phpstan-frankenphp) and star the repository on [GitHub](https://github.com/nowo-tech/PhpStanFrankenPhp).

PHPStan rules that help you migrate from **PHP-FPM** to **FrankenPHP classic**, then to **worker** mode. Rules are split by level, documented with justification, and shipped with demos for every case.

Documentation
-------------

[](#documentation)

- [Installation](docs/INSTALLATION.md)
- [Configuration](docs/CONFIGURATION.md)
- [Usage](docs/USAGE.md)
- [Contributing](docs/CONTRIBUTING.md)
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [Changelog](docs/CHANGELOG.md)
- [Upgrading](docs/UPGRADING.md)
- [Release](docs/RELEASE.md)
- [Security](docs/SECURITY.md)
- [Engram](docs/ENGRAM.md)
- [Spec-driven development](docs/SPEC-DRIVEN-DEVELOPMENT.md)
- [GitHub Spec Kit](docs/SPEC-KIT.md)

### Additional documentation

[](#additional-documentation)

- [Rule catalog](docs/RULES.md)
- [Migration guide (FPM → classic → worker)](docs/MIGRATION.md)
- [FrankenPHP demos](docs/DEMO-FRANKENPHP.md)
- [Demos](demo/README.md)
- [GitHub Actions CI requirements](docs/GITHUB_CI.md)
- [Branching strategy](docs/BRANCHING.md)

Why
---

[](#why)

FrankenPHP classic already changes process lifetime compared to FPM (`exit`/`die`, FastCGI APIs, unbounded I/O). Worker mode keeps the app in memory: statics, globals, and `$_ENV` mutations survive across requests. This extension surfaces those sites in CI so you can fix them in order.

**Fixes stay FPM-compatible.** The suggested remediations are portable patterns (no FrankenPHP-only APIs). They make the codebase more solid on FPM and safe for worker mode. Details: [docs/MIGRATION.md — FPM compatibility](docs/MIGRATION.md#fpm-compatibility-important).

Levels (application order)
--------------------------

[](#levels-application-order)

OrderRulesetWhen1[`ruleset-classic.neon`](ruleset-classic.neon)Moving FPM → FrankenPHP **classic**2[`ruleset-worker.neon`](ruleset-worker.neon)Enabling FrankenPHP **worker**2b[`ruleset-worker-strict.neon`](ruleset-worker-strict.neon)Optional: also flag `$_GET`/`$_POST`/…3[`ruleset-hardening.neon`](ruleset-hardening.neon)Production hardening (timeouts, fork, sleep)Full catalog: [docs/RULES.md](docs/RULES.md).

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

[](#installation)

```
composer require --dev nowo-tech/phpstan-frankenphp
```

Enable levels intentionally (rules are **not** auto-enabled by `extension.neon`):

```
# phpstan.neon
includes:
    - vendor/nowo-tech/phpstan-frankenphp/ruleset-classic.neon
    # - vendor/nowo-tech/phpstan-frankenphp/ruleset-worker.neon
    # - vendor/nowo-tech/phpstan-frankenphp/ruleset-worker-strict.neon
    # - vendor/nowo-tech/phpstan-frankenphp/ruleset-hardening.neon
```

See [docs/CONFIGURATION.md](docs/CONFIGURATION.md) and [docs/RULES.md](docs/RULES.md).

Quick example
-------------

[](#quick-example)

```
// Flagged by classic rules:
exit(1);
fastcgi_finish_request();
$process->setTimeout(null);

// Flagged by worker rules:
private static array $cache = [];
static $count = 0;
$_ENV['TOKEN'] = $requestToken;

// Flagged by hardening rules:
set_time_limit(0);
sleep(5);
pcntl_fork();
```

Demos
-----

[](#demos)

### Symfony 8 + FrankenPHP

[](#symfony-8--frankenphp)

```
make -C demo/symfony8 up
# Demo started at: http://localhost:8090
make -C demo/symfony8 phpstan-classic   # expect findings on AntiPattern/
```

FrankenPHP worker mode: **supported** (tested in the Symfony 8 demo with `FRANKENPHP_MODE=worker` by default). See [docs/DEMO-FRANKENPHP.md](docs/DEMO-FRANKENPHP.md).

### Fixture demos

[](#fixture-demos)

Intentional violations and clean counterparts under [`demo/`](demo/README.md):

```
composer demo-classic       # expect findings
composer demo-worker
composer demo-hardening
composer demo-classic-good  # must be clean
```

Tests and coverage
------------------

[](#tests-and-coverage)

```
make test
make test-coverage
```

- PHPUnit suites: `tests/Rule` (RuleTestCase per rule), `tests/Unit` (helpers / edge branches), `tests/Integration` (neon wiring).
- Line coverage on `src/`: **100%** (enforced via `composer coverage-check` / CI on PHP 8.2).

Development
-----------

[](#development)

```
make setup-hooks
make ensure-up
make qa
make demo-all
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance100

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

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

---

Tags

symfonyPHPStanlaravelstatic analysismigrationphp-fpmcode qualityfrankenphpworkerlong-running

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nowo-tech-phpstan-frankenphp/health.svg)

```
[![Health](https://phpackages.com/badges/nowo-tech-phpstan-frankenphp/health.svg)](https://phpackages.com/packages/nowo-tech-phpstan-frankenphp)
```

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.4k139.2M10.1k](/packages/rector-rector)[larastan/larastan

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

6.5k55.4M9.1k](/packages/larastan-larastan)[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.

4853.5M98](/packages/shipmonk-dead-code-detector)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M442](/packages/ssch-typo3-rector)[ekino/phpstan-banned-code

Detected banned code using PHPStan

3016.2M119](/packages/ekino-phpstan-banned-code)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)

PHPackages © 2026

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