A foundation package for building structured, maintainable WordPress plugins using modern PHP practices.
- PHP 8.2+
- Composer
- WordPress
composer require sherv/wp-plugin-foundationuse Sherv\Foundation\Plugin;
$plugin = Plugin::new( __FILE__ )
->with_plugin_properties()
->with_providers()
->build();
register_activation_hook( __FILE__, [ $plugin, 'on_plugin_activation' ] );
register_deactivation_hook( __FILE__, [ $plugin, 'on_plugin_deactivation' ] );
add_action( 'plugins_loaded', [ $plugin, 'boot' ] );- Introduction: Overview, features, and quick start.
- Getting Started: Step-by-step setup for a new plugin.
- Architecture: Components overview and UML diagram.
- Plugin Builder: Builder API, paths, and plugin properties.
- Service Providers: Creating, registering, and booting providers.
- Plugin Lifecycle: Activation, deactivation, and boot process.
- Container: Accessing the DI container and resolving services.
- Requirements Validation: Pre-boot environment checks.
- Exceptions: Error handling reference.
git clone https://github.com/shervElmi/wp-plugin-foundation.git
cd wp-plugin-foundation
composer install| Command | Description |
|---|---|
composer test |
Run the test suite |
composer test:coverage |
Run tests with code coverage |
composer lint |
Run PHP CodeSniffer |
composer format |
Auto-fix coding standards violations |
Contributions are welcome. Please open an issue or pull request on GitHub.
To report a security vulnerability, please see SECURITY.md.
See CHANGELOG.md for a history of notable changes.
© Sherv Elmi. Licensed under the MIT License. Distributed without any warranty. See the license for details.