base-plugin¶
Shared base library for Barberklingen/Subscribed WordPress plugins. This package contains no WordPress plugin header — it is bootstrapped by the consuming plugin.
What's in this package¶
| Area | Description |
|---|---|
| Architecture | Directory layout, bootstrap sequence, DI container |
| Migrations | Versioned DB schema migrations + recurring deployment tasks |
| Modules | Feature modules (renewals, addons, replacement orders, referral coupons, security) |
| Storage & ORM | Custom table ORM with typed casting |
| Traits | Reusable behaviours — Scheduler, AjaxEndpoint, WCAPIEndpoint |
| REST API | Base classes for registering WP REST routes |
| Helpers | Request parsing, date/renewal utilities, WC admin detection |
| Frontend Assets | Asset enqueueing with manifest support |
| Payments | Payment handler contract |
| Staging | WP-CLI command for syncing production data to staging |
| Testing | Running and writing tests |
Quick start¶
use Barberklingen\BasePlugin\DependencyManagement\GlobalContainer;
use Barberklingen\BasePlugin\Modules\BasePluginSetup;
// 1. Wire up the DI container
GlobalContainer::get_instance()->setup($container, new MyAppConfig());
// 2. Register any extra service providers before modules initialise
GlobalContainer::get_instance()->addProviders([new MyServiceProvider()]);
// 3. Boot the base plugin (runs migrations, admin hooks, renewals, staging CLI)
BasePluginSetup::get_instance();
Migrations are triggered by firing the barberklingen/migrations/completed action, typically from the consuming plugin's plugins_loaded callback.