arts / elementor-stubs
Comprehensive PHPStan stubs for Elementor and Elementor Pro WordPress page builder - auto-generated, self-contained, plug & play
Fund package maintenance!
Requires
- php: >=8.0
- php-stubs/woocommerce-stubs: ^10.5 || ^11.0
- php-stubs/wordpress-stubs: ^6.9
- php-stubs/wp-cli-stubs: ^2.12
Requires (Dev)
- captainhook/captainhook: ^5.27
- ergebnis/composer-normalize: ^2.48
- php-stubs/generator: ^0.8 || ^0.9
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.0
- vlucas/phpdotenv: ^5.6
- wp-coding-standards/wpcs: ^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Comprehensive PHPStan stubs for Elementor and Elementor Pro WordPress page builder.
Get full IDE autocomplete, IntelliSense, and type safety when developing Elementor widgets, extensions, and custom implementations.
Features
- Full IDE autocomplete for all Elementor and Elementor Pro classes
- Type safety and static analysis with PHPStan
- Catch errors before runtime when developing widgets and extensions
- Self-contained - includes all necessary Elementor constants
- Auto-updated with new Elementor releases
Requirements
- PHP 8.0 or higher
- PHPStan for static analysis
- Automatically includes WordPress, WP-CLI and WooCommerce stubs as dependencies
Installation
composer require --dev arts/elementor-stubs
Usage with PHPStan
Add to your phpstan.neon:
parameters: bootstrapFiles: - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php - vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php - vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php - vendor/arts/elementor-stubs/elementor-stubs.php
Elementor's WP-CLI commands extend WP_CLI_Command and bootstrapFiles are executed in order, so wp-cli-stubs.php must be listed before elementor-stubs.php.
The stubs include both Elementor Free and Elementor Pro type definitions.
Note: Stubs are versioned to match Elementor releases. Check releases for your specific Elementor version.
Regenerating Stubs
For contributors or to generate stubs from a specific Elementor version:
- Copy
.env.exampleto.env - Set
ELEMENTOR_PATHto your Elementor installation - Optionally set
ELEMENTOR_PRO_PATHfor Pro stubs - Run:
composer generate
cp .env.example .env
# Edit .env with your paths
composer generate
💖 Support
If you find this plugin useful, consider buying me a coffee:
Made with ❤️ by Artem Semkin