-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Generators
WP-CLI commands that scaffold features from stubs using the real conventions, plus the create-project
Personalizer. All are registered under defined('WP_CLI') next to matrix:clean.
wp matrix:make:model Book # app/Model/Book.php (static $table/$fillable/$rules/$sortable)
wp matrix:make:migration create_books_table # database/migrations/<ts>_create_books_table.php
wp matrix:make:controller Book # app/Http/Controllers/BookController.php (fill→validate→save→respond)
wp matrix:make:listpage Book # app/Admin/BookListPage.php + registers in AdminServiceProvider::$pages
wp matrix:make:adminpage Reports # app/Admin/ReportsPage.php + registers it
wp matrix:make:route --method=GET --path=books --controller=Book --action=index # appends to app/routes.php
wp matrix:make:resource Book # model + migration + controller + listpage + routes, in order
wp matrix:make:types # app/Support/RouteNames.php + resources/js/admin/types/wppmRoutes.d.tsEvery generator:
-
presence-checks its target — refuses to overwrite an existing file unless
--force, -
injects registrations idempotently (re-running won't duplicate the
use/$pages/Router::lines), - supports
--dry-run(writes nothing; shows what it would do).
Run wp help matrix:make:<thing> for per-command options. Stubs live in the root stubs/ directory — edit
them to change what your team's generators produce.
wp matrix:make:types reads the live Router registry and emits:
-
app/Support/RouteNames.php— PHP constants for every route name, -
resources/js/admin/types/wppmRoutes.d.ts— TypeScript types forwindow.wppmRoutes,
so $rest('GET', 'books.index') autocompletes and type-checks. Regenerate it after adding routes.
composer create-project wp-plugin-matrix/starter my-plugin runs rename-plugin.php via
post-create-project-cmd. It prompts for the plugin name, namespace, and vendor, rewrites
every identity token (longest-first so compound tokens like WP_PLUGIN_MATRIX_VERSION aren't clobbered),
sets the <vendor>/<slug> composer name, skips vendor//node_modules//.git//dist/, writes only
changed files, and deletes itself on success. Preview with php rename-plugin.php "My Plugin" --dry-run.
wp matrix:clean # strip the Task demo → blank starterSee Demo & Reset.
WP Plugin Matrix · GPL-2.0-or-later · source · pages are generated from docs/wiki/ — edit there, not in the wiki UI.
Seams
Tooling