Skip to content

Phase 01 — Bootstrap & Scaffolding

Stand up the WordPress plugin skeleton so the plugin activates cleanly on a fresh WordPress install and the docs site scaffolding is in place and building.

  • wp-license-manager.php — Plugin header with all standard WordPress fields, PHP version gate, autoloader registration (Composer vendor or fallback PSR-4), activation/deactivation hook registration, and plugins_loaded boot trigger.
  • uninstall.php — Guarded uninstall routine that drops all 15 WPLM tables and removes all plugin options. Honours the wplm_keep_data_on_uninstall option to prevent accidental data loss.
  • composer.json — PSR-4 autoload map for WPLM\src/, dev deps (phpunit, phpcs, WPCS, Brain Monkey).
  • src/Container.php — Lightweight DI container. Supports bind() (factory closures), make() (cached singleton resolution), has(), and instance() (direct registration). Auto-resolves concrete classes with no deps as a fallback.
  • src/Plugin.php — Main singleton, boots on plugins_loaded. Owns the Container, registers all service bindings, wires WordPress hooks (rest_api_init, init, woocommerce_loaded, cron), and holds the static activate() / deactivate() methods called by WordPress hooks.
  • src/Install/Installer.php — Creates all 15 tables via dbDelta(), stores wplm_db_version, and hands off to Migrator on version bump.
  • src/Install/Migrator.php — Stub versioned migrator; hosts migration methods as the schema evolves.
  • src/Install/Seeder.php — Generates the four long-lived cryptographic secrets on first activation (Ed25519 keypair, AES-256-GCM key, HMAC-SHA256 fingerprint secret, webhook secret). Also seeds default plugin options.
  • docs-site/package.json — Astro + Starlight dependencies.
  • docs-site/astro.config.mjs — Starlight config with full sidebar group structure matching Section 13.2.
  • docs-site/tsconfig.json — Strict TypeScript config.
  • docs-site/src/content/docs/index.mdx — Homepage / overview page with feature cards.
  • docs-site/src/content/docs/getting-started/ — Installation, First License, REST API Keys skeleton pages.
// Bootstrap sequence (simplified)
add_action( 'plugins_loaded', [ 'WPLM\\Plugin', 'get_instance' ] );
// Plugin::get_instance() creates the singleton, registers services,
// then wires WP hooks including REST API, cron, and admin menu.
// On activation, Installer runs dbDelta for all 15 tables,
// then Seeder generates crypto secrets and stores default options.
  1. Upload the plugin to wp-content/plugins/wp-license-manager.
  2. Activate in Plugins → Installed Plugins — no PHP notices should appear.
  3. Verify tables exist:
    SHOW TABLES LIKE 'wp_wplm_%';
    -- Should return 15 rows
  4. Check options:
    SELECT option_name FROM wp_options WHERE option_name LIKE 'wplm_%';
    -- Should include wplm_db_version, wplm_signing_keypair, wplm_encryption_key, etc.
  5. Docs site: cd docs-site && npm install && npm run builddist/ should be populated.
  • Activation clean — Plugin activates with no PHP notices; all 15 tables created; secrets generated.