phpstan/php-8-stubs

PHP stubs extracted from php-src

Maintainers

👁 ondrejmirtes

Package info

github.com/phpstan/php-8-stubs

pkg:composer/phpstan/php-8-stubs

Statistics

Installs: 6 611 943

Dependents: 2

Suggesters: 0

Stars: 31

Open Issues: 7

0.4.36 2026-06-11 00:57 UTC

Requires

None

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT, PHP-3.01 ebf5165cee30780bdfd229e0ff7d599998d92695

This package is auto-updated.

Last update: 2026-06-11 13:58:19 UTC


README

PHP stub files automatically extracted from php-src. Used by PHPStan to understand signatures of built-in PHP classes and functions for PHP 8.0+.

Features

  • Version-aware stubs covering PHP 8.0 through 8.5, with #[\Since('x.y')] and #[\Until('x.y')] attributes to track when symbols and signatures were added or removed.
  • Comprehensive coverage: core language stubs (Zend/), 69 extensions (ext/), and 6 SAPIs (sapi/).
  • Version-aware class/function map (Php8StubsMap) that accepts a $phpVersionId and returns only the symbols available in that PHP version.
  • Fully automated extraction via extractor/extract.php — stubs are never hand-written.
  • Daily CI updates that extract from all PHP 8.x branches, auto-tag releases, and open PRs in phpstan/phpstan-src.

Usage

$map = new \PHPStan\Php8StubsMap($phpVersionId); // e.g. 80300 for PHP 8.3.0
$map->classes; // array<string, string> — lowercase class name => stub path
$map->functions; // array<string, string> — lowercase function name => stub path

License

Dual-licensed under MIT and PHP-3.01.