Skip to content

kyle-niemiec/wp-plugin-framework

Repository files navigation

WordPress Plugin Framework (WPPF)

Documentation

The WordPress Plugin Framework (WPPF) is the culmination of a few years of my hard work building WordPress plugins and the need for a stricter organization than what examples I had seen. It is built to automate boilder-plate code of registering post types and meta boxes, enqueuing assets, separating administrative functionality, and more. While a set of classes manages many of the native WordPress function calls, developers are more free to define "modules", which describe parts of a plugin and focus on assigning functionality to actions and filters to build out custom functionality. Best practices for WordPress PHP Coding Standards are encouraged through the use of file names, variable conventions, whitespace, and more.

Quick Example

A minimal WPPF module might look like this:

class My_API extends Module
{
    public static function construct(): void {
        add_action( 'rest_api_init', [ __CLASS__, 'init' ] );
    }

    public static function init(): void {
        register_rest_route( ... )
    }
}

Example Plugin

If you'd like to see how WPPF is used in a real project, check out the WPPF Test Plugin.

It demonstrates:

  • custom post types
  • structured post meta with validation
  • admin modules
  • WooCommerce email integration
  • upgrade schemas

Features

  • Set of object-oriented classes abstracting WordPress concepts with accessible methods.
  • Map-backed PSR-4 autoloader separating projects into functional "modules".
  • CLI-generated scaffolding for plugins, post types, meta, screens, and meta boxes.
  • Versioned framework namespaces with backward compatibility support.
  • Assortment of tools for productivity including:
    • Template loading with variable support.
    • Admin notice messaging system.
    • Upgrade actions for specific plugin versions.
    • CRON-based, lightweight action scheduler.

Requirements

  • WordPress development environment
  • Composer for installing the framework

Installation

  1. Create a plugin project folder with a name matching your plugin slug. (e.g. "My Test Plugin" has the slug "my-test-plugin").
mkdir my-test-plugin ; cd my-test-plugin
  1. Install the framework via Composer from inside the folder you just created:
composer require kyle-niemiec/wp-plugin-framework
  1. Install the framework’s dev dependencies (required for the CLI):
cd vendor/kyle-niemiec/wp-plugin-framework
composer install --dev
cd ../../../
  1. Run the CLI using the vendor-packaged binary
vendor/bin/wppf list

CLI Commands

Common scaffolding commands (run from your plugin root):

  • make:plugin — create the main plugin file
  • make:plugin-admin — create an admin module class
  • make:post-type — create a custom post type class
  • make:post-meta — create a post meta class
  • make:post-screen — create a post screen class
  • make:meta-box — create a meta box class + template

License

GPL-3.0. See license.txt.

Contributing

Issues and PRs are welcome. Please follow the project and WordPress PHP Coding Standards when contributing.

WPPF Ecosystem

This project is part of the WPPF ecosystem:

WordPress Plugin Framework (WPPF) – Core plugin architecture framework

WPPF Test Plugin – Example project demonstrating a implementation of a plugin using WPPF.

WP Plugin Update Server – Self-hosted WordPress plugin update infrastructure with GUI management.

WPPF Update Helper – Simple integration layer for the WP Plugin Update Server.