WP Manifestindependent plugin directory
manifest / developer / wordpress-plugin-base

Wordpress plugin base

A baseline plugin by Acentrix, intended as a starting point for custom plugin development. Includes Roots Acorn bootstrapping and lifecycle hooks for Laravel-esque WordPress plugin development.

by Jordan Wilson · github.com/acentrix-jordan/wordpress-plugin-base · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/acentrix-jordan/wordpress-plugin-base/archive/refs/heads/main.zip

Readme

WordPress Plugin Base

A baseline plugin by Acentrix, intended as a starting point for custom plugin development. Includes Roots Acorn bootstrapping and lifecycle hooks for Laravel-esque WordPress plugin development.

Requirements

Getting started

  1. Clone (or copy) this repository into wp-content/plugins/.

  2. Install dependencies:

    composer install
  3. Activate the plugin from the WordPress admin.

How it works

  • index.php registers the plugin's lifecycle hooks (activation/deactivation) at file scope, then boots Acorn on after_setup_theme. Lifecycle hooks fire before Acorn's normal boot, so they boot the application on demand via wordpress_plugin_base_boot() before using any Laravel services.
  • constants.php defines PLUGIN_ENTRY and pins ACORN_BASEPATH to src/ so this plugin's Acorn instance doesn't conflict with other Acorn-based themes or plugins on the same site.
  • src/App/Providers/PluginServiceProvider.php is the root service provider — register bindings in register() and hook into WordPress in boot().
  • src/config/ holds the Laravel-style config files; src/storage/ holds framework caches and logs.

Logging

Laravel logging is configured in src/config/logging.php and writes to:

src/storage/logs/laravel.log

Activation and deactivation events are logged there via the Log facade.

Building a release

./build.sh

This stages the plugin, runs a clean composer install --no-dev --optimize-autoloader, strips dev tooling and runtime artifacts (logs, framework caches, IDE files), and emits an installable zip:

dist/wordpress-plugin-base-<version>.zip

The version is read from the Version: header in index.php. Install the zip via Plugins → Add New → Upload Plugin, or:

wp plugin install dist/wordpress-plugin-base-<version>.zip --activate

Extending

When using this as the base for a new plugin:

  1. Rename the plugin directory and update the Plugin Name: / Description: headers in index.php.
  2. Update the version and bump it for each release before running ./build.sh.
  3. Add service providers under src/App/Providers/ and register them in index.php's withProviders([...]) call.

Read the full README on GitHub →