php-stubs / wordpress-stubs
WordPress function and class declaration stubs for static analysis.
Installs: 6 275 101
Dependents: 196
Suggesters: 1
Security: 0
Stars: 147
Watchers: 6
Forks: 18
Open Issues: 11
Requires (Dev)
- php: ^7.4 || ^8.0
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- nikic/php-parser: ^4.13
- php-stubs/generator: ^0.8.3
- phpdocumentor/reflection-docblock: ^5.4.1
- phpstan/phpstan: ^1.10.49
- phpunit/phpunit: ^9.5
- szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset: ^1.0
- wp-coding-standards/wpcs: 3.1.0 as 2.3.0
Suggests
- paragonie/sodium_compat: Pure PHP implementation of libsodium
- symfony/polyfill-php80: Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
- szepeviktor/phpstan-wordpress: WordPress extensions for PHPStan
- dev-master
- v6.6.2
- v6.6.1
- v6.6.0
- v6.5.5
- v6.5.4
- v6.5.3
- v6.5.2
- v6.5.0
- 6.4.x-dev
- v6.4.5
- v6.4.4
- v6.4.3
- v6.4.2
- v6.4.1
- v6.4.0
- v6.3.5
- v6.3.4
- v6.3.3
- v6.3.2
- v6.3.1
- v6.3.0
- v6.2.6
- v6.2.5
- v6.2.4
- v6.2.3
- v6.2.2
- v6.2.1
- v6.2.0
- v6.1.7
- v6.1.6
- v6.1.5
- v6.1.4
- v6.1.3
- v6.1.2
- v6.1.1
- v6.1.0
- v6.0.9
- v6.0.8
- v6.0.7
- v6.0.6
- v6.0.5
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.9.9
- v5.9.8
- v5.9.7
- v5.9.6
- v5.9.5
- v5.9.4
- v5.9.3
- v5.9.2
- v5.9.1
- v5.9.0
- v5.8.9
- v5.8.8
- v5.8.7
- v5.8.6
- v5.8.5
- v5.8.4
- v5.8.3
- v5.8.2
- v5.8.1
- v5.8.0
- v5.7.11
- v5.7.10
- v5.7.9
- v5.7.8
- v5.7.7
- v5.7.6
- v5.7.5
- v5.7.4
- v5.7.3
- v5.7.2
- v5.7.1
- v5.7.0
- v5.6.13
- v5.6.12
- v5.6.11
- v5.6.10
- v5.6.9
- v5.6.8
- v5.6.7
- v5.6.6
- v5.6.5
- v5.6.4
- v5.6.3
- v5.6.2
- v5.6.1
- v5.6.0
- v5.5.14
- v5.5.13
- v5.5.12
- v5.5.11
- v5.5.10
- v5.5.9
- v5.5.8
- v5.5.7
- v5.5.6
- v5.5.5
- v5.5.4
- v5.5.3
- v5.5.2
- v5.5.1
- v5.5.0
- v5.4.15
- v5.4.14
- v5.4.13
- v5.4.12
- v5.4.11
- v5.4.10
- v5.4.9
- v5.4.8
- v5.4.7
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.17
- v5.3.16
- v5.3.15
- v5.3.14
- v5.3.13
- v5.3.12
- v5.3.11
- v5.3.10
- v5.3.9
- v5.3.8
- v5.3.7
- v5.3.6
- v5.3.5
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.20
- v5.2.19
- v5.2.18
- v5.2.17
- v5.2.16
- v5.2.15
- v5.2.14
- v5.2.13
- v5.2.12
- v5.2.11
- v5.2.10
- v5.2.9
- v5.2.8
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2
- v5.1.18
- v5.1.17
- v5.1.16
- v5.1.15
- v5.1.14
- v5.1.13
- v5.1.12
- v5.1.11
- v5.1.10
- v5.1.9
- v5.1.8
- v5.1.7
- v5.1.6
- v5.1.5
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1
- v5.0.21
- v5.0.20
- v5.0.19
- v5.0.18
- v5.0.17
- v5.0.16
- v5.0.15
- v5.0.14
- v5.0.13
- v5.0.12
- v5.0.11
- v5.0.10
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.4
- v5.0.2
- v5.0.1
- v5.0
- v4.9.20
- v4.9.19
- v4.9.18
- v4.9.17
- v4.9.16
- v4.9.15
- v4.9.14
- v4.9.13
- v4.9.12
- v4.9.11
- v4.8.19
- v4.8.18
- v4.8.17
- v4.8.16
- v4.8.15
- v4.8.14
- v4.8.13
- v4.8.12
- v4.8.11
- v4.8.10
- v4.7.23
- v4.7.22
- v4.7.21
- v4.7.20
- v4.7.19
- v4.7.18
- v4.7.17
- v4.7.16
- v4.7.15
- v4.7.14
- dev-foxy
- dev-szepeviktor-patch-2
- dev-szepeviktor-patch-1
This package is auto-updated.
Last update: 2024-10-12 23:03:40 UTC
README
Important
Hello everyone! This is Viktor who runs the php-stubs organization. I am planning to stop contributing to the WordPress ecosystem because it is extremely difficult and I do not earn (min) €100/month.
Please support my work to avoid abandoning this package.
Thank you!
WordPress Stubs
It provides stub declarations for WordPress core functions, classes and interfaces, globals are not included. These stubs can help plugin and theme developers leverage static analysis tools like PHPStan.
The stubs are generated from @johnpbloch's package using php-stubs/generator.
Requirements
- PHP 7.4 or 8.0
Installation
Require this package as a development dependency with Composer.
composer require --dev php-stubs/wordpress-stubs
Alternatively you may download wordpress-stubs.php
directly.
Usage with PHPStan
composer require --dev szepeviktor/phpstan-wordpress
The package szepeviktor/phpstan-wordpress
depends on phpstan/phpstan
and this one.
Please do read
that package's README
and see the example
directory over there.
Usage with Psalm
Update your Psalm config to include this section.
<stubs> <file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php" /> </stubs>
Furthermore ensure WordPress core is not included in <projectFiles>
.
Usage in Intellisense
If your IDE has trouble parsing all of WordPress you may find the stubs useful for enabling code completion and related features. For example there are instructions for usage with VSCode's Intelephense extension.
Versioning
This package is versioned to match the WordPress version from which the stubs are generated.
Generating stubs for a different WordPress version
- Run modern PHP version
- Clone this repository and
cd
into it - Update
"johnpbloch/wordpress": "x.x.x"
insource/composer.json
with the desired version - Run
composer update
- And run
./generate.sh
The wordpress-stubs.php
file should now be updated.