mralaminahamed / freemius-stubs
Freemius WordPress SDK function and class declaration stubs for static analysis.
Installs: 1 262
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- php-stubs/wordpress-stubs: ^5.3 || ^6.0
Requires (Dev)
- php-stubs/generator: ^0.8.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^7.5 || ^8.5 || ^9.5
- squizlabs/php_codesniffer: ^3.7
Suggests
- symfony/polyfill-php73: Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
- szepeviktor/phpstan-wordpress: WordPress extensions for PHPStan
- dev-main
- v2.10.1
- v2.9.0
- v2.8.1
- v2.8.0
- v2.7.4
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.12
- v2.5.11
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.4-rc.1
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0-rc.2
- v2.5.0-rc.1
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.1
- v1.7.4
- v1.7.3
- v1.2.4
- v1.2.3
- v1.2.2.9
- v1.2.2.8
- v1.2.1.6
- v1.2.1.5
- v1.2.1
- v1.2.0
- v1.1.9
- v1.1.8.1
- v1.1.8
- v1.1.7.5
- v1.1.7.4
- v1.1.7.3
- v1.1.6.5
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.0.1
- v1.0
This package is auto-updated.
Last update: 2024-12-29 04:13:33 UTC
README
PHP stub declarations for the Freemius WordPress SDK to enhance IDE completion and static analysis capabilities. Generated using php-stubs/generator directly from the source code.
🚀 Features
- Complete function, class, and interface declarations
- Constant definitions for proper static analysis
- IDE autocompletion support
- PHPStan integration
- Regular updates with latest Freemius SDK versions
📋 Requirements
- PHP >= 7.1
- Composer for dependency management
📦 Installation
Via Composer (Recommended)
# Install as a development dependency composer require --dev mralaminahamed/freemius-stubs # Or specify a version composer require --dev mralaminahamed/freemius-stubs:^2.0
Manual Installation
Download the stub files directly:
🔧 Configuration
PHPStan Integration
Add the stubs to your phpstan.neon
configuration:
parameters: bootstrapFiles: - vendor/mralaminahamed/freemius-stubs/freemius-constants-stubs.php - vendor/mralaminahamed/freemius-stubs/freemius-stubs.php
IDE Configuration
Most modern IDEs will automatically detect the stubs when installed via Composer. For manual installation, add the stub files to your IDE's include path.
PhpStorm
- Go to
Settings
→PHP
→Include Path
- Add the directory containing the stub files
VS Code
Add to your settings.json
:
{ "php.stubs": [ "vendor/mralaminahamed/freemius-stubs/freemius-stubs.php", "vendor/mralaminahamed/freemius-stubs/freemius-constants-stubs.php" ] }
🔍 Usage Example
<?php // Your code will now have full IDE support $fs = Freemius::instance(); // Constants are properly defined if (WP_FS__SDK_VERSION) { // Your implementation } // Interfaces and classes are available class MyIntegration implements Freemius_Api_Interface { // Your implementation }
🛠 Development
Building Stubs
# Clone the repository git clone https://github.com/mralaminahamed/phpstan-freemius-stubs.git cd phpstan-freemius-stubs # Install dependencies composer install # Generate stubs composer generate # Release new version composer release
Running Tests
# Run all checks composer check # Individual checks composer cs # Coding standards composer analyze # Static analysis composer test # Unit tests
📚 Documentation
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Freemius for the WordPress SDK
- php-stubs/generator for the stub generation tools
- All contributors to this project
💬 Support
For bug reports and feature requests, please use the GitHub Issues.
For questions and discussions, please use the GitHub Discussions.