|
1 | 1 | # phpstan_turbo — native acceleration extension for PHPStan |
2 | 2 |
|
3 | | -**Experimental.** A plain Zend C++ extension (no framework dependencies) |
4 | | -that reimplements PHPStan's hottest code paths natively. It is entirely optional: |
5 | | -PHPStan behaves identically without it, just slower. With the extension |
6 | | -loaded, analysis output is bit-for-bit identical — only faster (~25% on |
7 | | -PHPStan's own single-threaded self-analysis). |
| 3 | +**Experimental.** A native extension that reimplements PHPStan's hottest |
| 4 | +code paths in C++. It is entirely optional: PHPStan behaves identically |
| 5 | +without it, just slower. With the extension loaded, analysis output is |
| 6 | +bit-for-bit identical — only faster (~25% on PHPStan's own single-threaded |
| 7 | +self-analysis). |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +**Most users do not need to install anything.** The |
| 12 | +[phpstan/phpstan](https://github.com/phpstan/phpstan) Composer package ships |
| 13 | +prebuilt binaries for the most common platforms — Linux (glibc and musl, |
| 14 | +x86_64 and arm64), macOS, and Windows (x86_64), for PHP 8.3 and newer — and |
| 15 | +PHPStan automatically loads the one matching your runtime into its worker |
| 16 | +processes. |
| 17 | + |
| 18 | +Installing the extension with [PIE](https://github.com/php/pie) is only |
| 19 | +needed when you download and run `phpstan.phar` manually, outside of |
| 20 | +Composer (the prebuilt binaries ship next to the phar in the Composer |
| 21 | +package, not inside it): |
| 22 | + |
| 23 | +```bash |
| 24 | +pie install phpstan/turbo |
| 25 | +``` |
| 26 | + |
| 27 | +Useful to know: |
| 28 | + |
| 29 | +- `vendor/bin/phpstan diagnose` reports the extension's status. |
| 30 | +- `PHPSTAN_TURBO=0` turns it off. |
| 31 | +- The extension only activates when its version matches the one your PHPStan |
| 32 | + release expects — on a mismatch PHPStan prints a note and runs without it, |
| 33 | + so an outdated extension can never affect results, only speed. |
| 34 | + |
| 35 | +# Developer notes |
| 36 | + |
| 37 | +A plain Zend C++ extension, no framework dependencies. |
8 | 38 |
|
9 | 39 | ## How it works — the stub-shadowing pattern |
10 | 40 |
|
|
0 commit comments