sherv/wp-plugin-foundation

A structured foundation for building maintainable WordPress plugins using modern PHP practices, service providers, a DI container, and lifecycle management.

Maintainers

Package info

github.com/shervElmi/wp-plugin-foundation

pkg:composer/sherv/wp-plugin-foundation

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v1.0.0 2026-04-01 09:11 UTC

README

A foundation package for building structured, maintainable WordPress plugins using modern PHP practices.

License: MIT PHP Version

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

  1. Introduction: Overview, features, and quick start.
  2. Getting Started: Step-by-step setup for a new plugin.
  3. Architecture: Components overview and UML diagram.
  4. Plugin Builder: Builder API, paths, and plugin properties.
  5. Service Providers: Creating, registering, and booting providers.
  6. Plugin Lifecycle: Activation, deactivation, and boot process.
  7. Container: Accessing the DI container and resolving services.
  8. Requirements Validation: Pre-boot environment checks.
  9. 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.