sherv / wp-plugin-foundation
A structured foundation for building maintainable WordPress plugins using modern PHP practices, service providers, a DI container, and lifecycle management.
v1.0.0
2026-04-01 09:11 UTC
Requires
- php: >=8.2
- sherv/wp-di-container: ^1.0
Requires (Dev)
- automattic/vipwpcs: ^3.0.1
- brain/monkey: ^2.7
- dealerdirect/phpcodesniffer-composer-installer: ^1.2.0
- mockery/mockery: ^1.6.12
- phpcompatibility/phpcompatibility-wp: ^2.1.8
- phpunit/phpunit: ^11.5
This package is auto-updated.
Last update: 2026-05-11 00:24:24 UTC
README
A foundation package for building structured, maintainable WordPress plugins using modern PHP practices.
Requirements
- PHP 8.2+
- Composer
- WordPress
Installation
composer require sherv/wp-plugin-foundation
Quick Start
use 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' ] );
Documentation
- 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.
Development
git clone https://github.com/shervElmi/wp-plugin-foundation.git
cd wp-plugin-foundation
composer install
Scripts
| 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 |
Contributing
Contributions are welcome. Please open an issue or pull request on GitHub.
Security
To report a security vulnerability, please see SECURITY.md.
Changelog
See CHANGELOG.md for a history of notable changes.
License
© Sherv Elmi. Licensed under the MIT License. Distributed without any warranty. See the license for details.