Skip to content

Demo and Reset

Lukman Nakib edited this page May 31, 2026 · 2 revisions

Demo & Reset

The scaffold ships a kitchen-sink Task feature so you can see every seam working end-to-end, then remove it in one command when you're ready to build your own thing.

What the demo exercises

app/Model/Task.php, app/Admin/TasksListPage.php, app/Http/Controllers/TasksController.php, the Task*Handler hooks, the CreateTasksTable migration, and app/Views/tasks.php together demonstrate:

  • a Model with Rules → a ListPage CRUD table with the 5 auto REST routes + a rules-derived edit form,
  • a task CPT, a [wppm-tasks] shortcode (advertised on the admin page),
  • a tasks.stats AJAX route (Cache-backed),
  • a daily cron ("prune trashed tasks") via the wppm/lifecycle/cron_events filter,
  • a seed + activation Notice ("Demo data seeded") via wppm/lifecycle/seed_defaults,
  • light use of the Config and Cache facades.

Read it, copy from it, then strip it.

The Vue admin SPA also ships demo pages alongside the real ones: a Contact form (a validation example) and a Components Demo (an Element Plus showcase). The real pages are the Dashboard and the Settings form (Settings.vue) — which is the plugin's single settings screen (there is no separate Settings list page).

Reset to a blank starter

wp matrix:clean --dry-run     # preview exactly what will be removed (changes nothing)
wp matrix:clean               # delete the demo files + their registration lines
  • Requires the plugin active (it's a WP-CLI command the plugin registers).
  • Idempotent — re-running reports "nothing to remove".
  • Drift-safe — if the demo files/registrations were hand-edited, it refuses and lists what drifted (pass --force to override). This prevents leaving a dangling registration pointing at a deleted class.
  • Source-only — it deletes the demo's files and removes the exact lines it added; it does not touch the database, seeded rows, or cron. That teardown is the uninstall flow, gated behind apply_filters('wppm/uninstall_destructive', false).
  • Strips the demo admin pages too — besides the Task feature, clean removes the Vue SPA's Contact and Components Demo pages (their Pages/*.vue, route entries in routes.js, and sidebar items in Components/AdminMenu.vue). Run npm run build after a real clean to rebuild the SPA without them.

What survives a clean: the framework (app/Core, Facades, Helpers) and the Config/Cache bindings; the admin SPA's real Dashboard + Settings form (the single settings screen) + 404 page; the Tracer diagnostics page; the Settings model; and all the matrix:make:* generators — i.e. a clean, fully working starter.

Clone this wiki locally