wp-cli/scaffold-command
WP-CLI scaffold command generates starter code for WordPress post types, taxonomies, blocks, plugins, and child themes. Includes commands for building themes from Underscores with options for activation, SASS, and WooCommerce support.
What the package actually is. wp-cli/scaffold-command is a WP-CLI subcommand bundle that writes starter files to disk (or to STDOUT with --raw). It is a developer-workstation and CI-provisioning tool, not a runtime library. There is no service to call, no API surface to wrap, and no Laravel service-provider integration. For a Laravel-centric PHP organization, the honest framing is: this is a WordPress-only toolchain accelerator, and its value to us is entirely in codifying project bootstrap, not in application runtime.
Architecture fit. Poor fit for a Laravel codebase, good fit for a WordPress estate. The generated artifacts are opinionated toward a specific legacy stack: Grunt (Gruntfile.js, grunt-wp-i18n, grunt-wp-readme-to-markdown), CircleCI-first CI (with gitlab/bitbucket/github alternatives), readme.txt, .distignore, and a WP test-suite bootstrap pinned to WP_TESTS_DIR. The parts with cross-stack portability are narrow but real: the PHPUnit bootstrap pattern, .phpcs.xml.dist ruleset, bin/install-wp-tests.sh, and the CI config skeletons. The post-type/taxonomy generators emit register_post_type()/register_taxonomy() calls with label/i18n boilerplate — a genuinely tedious and error-prone block of WordPress code that benefits from deterministic generation.
Strategic risk — the maintainers have published a soft sunset signal. The README explicitly states that scaffolding plugins and themes is "no longer recommended for modern WordPress development" and points to @wordpress/create-block. wp scaffold block carries a hard deprecation warning in its own documentation. Any roadmap that depends on this package must be scoped to legacy WordPress maintenance and CPT/taxonomy registration, and must not be extended into block or modern theme work. Treat it as a stable-but-declining utility, not a platform to build on.
Delivery and quality signals are strong for what it is. MIT license, bundled by default in WP-CLI (so it is already on every WP-CLI install — zero procurement friction), active release cadence, GitHub Actions with PHPUnit + Behat + PHPStan + PHPCS and WP_CS enforcement. The Behat suite is the meaningful one: it asserts real files on disk, real exit codes, and real STDOUT/STDERR content, which is exactly the contract we would script against.
Key technical risks.
--force overwrites silently; there is no --dry-run. Generation into a populated directory is destructive and unguarded. Automation must pre-check paths.wp scaffold _s and wp scaffold child-theme fetch theme scaffolds; _s pulls from the Underscores project. Air-gapped or rate-limited CI will fail without a mirrored template.wp package install [email protected]:... — a git+SSH dependency in the build path.Key questions for the team.
wp scaffold block in our standards — banned, or grandfather-tolerant for existing sites?Stack fit. Position it strictly as a developer-environment and CI bootstrap tool in the WordPress lane. It has no role in a Laravel application: no Composer autoload surface we would consume, no HTTP layer, no Artisan analogue. Do not attempt to "Laravelize" it. The realistic scope is (a) standardized plugin scaffolding for WP work, and (b) borrowing its test-harness generator as the reference implementation for PHP unit testing in WordPress projects.
Where it earns its keep — a TPM-leverage map.
| Command | TPM leverage | Disposition |
|---|---|---|
wp scaffold plugin |
Golden-path plugin skeleton: main file, readme.txt, .distignore, .editorconfig, PHPCS, tests |
Adopt, with house overrides |
wp scaffold plugin-tests / theme-tests |
Fastest route to a working PHPUnit + WP test-suite harness with WP_TESTS_DIR injection |
Adopt; high value, low risk |
wp scaffold post-type / taxonomy |
Deterministic CPT/taxonomy registration with correct label/i18n boilerplate; --raw pipes to STDOUT for diffing |
Adopt |
wp scaffold child-theme |
Two-file child theme; trivial win, removes a class of copy-paste errors | Adopt (conditional) |
wp scaffold _s |
Underscores theme with --sassify / --woocommerce |
Tolerate for legacy; not for new builds |
wp scaffold block |
Deprecated upstream | Prohibit; mandate @wordpress/create-block |
Migration path. Three phases, sequenced by risk.
plugin-tests and post-type/taxonomy on one live project. No process change; measure time-to-first-green-test versus current baseline. This is the cheapest possible validation.make wp-plugin SLUG=...) that pins WP-CLI version, pre-checks target paths (compensating for the missing dry-run), asserts non-zero exit codes, and layers our own CI config over the generated CircleCI default. Store the resulting wrapper and override files in the platform repo. This converts a tool into a governed standard.Compatibility and sequencing notes.
_s scaffold source internally if CI has restricted egress.--force in automation without a prior existence check; prefer generating into a temp directory and moving artifacts in.composer phpcs / composer phpstan against generated code before acceptance — generated does not mean conformant to house standards.Maintenance. Low and mostly passive. Upstream carries the testing burden (Behat + PHPUnit + static analysis on every PR), MIT license removes commercial risk, and bundling with WP-CLI means no dependency to install for the baseline case. The real maintenance cost is ours: the wrapper script, the house overlay files, and periodic review of generated templates as WordPress tooling evolves. Budget roughly a day per quarter for review plus the cost of any override drift.
Support. Small blast radius — it runs on developer machines and in CI, not in production. Incidents manifest as failed scaffolding, not outages. First-line support should be the wrapper's README, not upstream issues; upstream is volunteer-maintained and its documented position is that plugin/theme scaffolding is legacy, which weakens the case for filing bugs against it.
Scaling. Scales trivially and is effectively free per invocation — it is local file generation with no service dependency, no rate limits, and no shared state. Concurrency is only an issue if two jobs scaffold into the same directory. The genuine scaling constraint is people, not throughput: every additional team consuming the wrapper inherits the same templates, which is exactly the consistency benefit we want.
Failure modes and mitigations.
--force clobbers work; there is no dry-run. Mitigation: path pre-check in the wrapper, --force never exposed to users directly._s / child-theme generation. Mitigation: internal mirror or cache the scaffold output as a vendored template.@wordpress/create-block or an internal template repo should not change the developer-facing command.tests/bootstrap.php depends on WP_TESTS_DIR and a MySQL/MariaDB test database. Mitigation: bake both into the standard dev container.Ramp-up. Effectively zero for developers already comfortable with WP-CLI: the commands are self-documenting, wp scaffold with no args lists subcommands, --raw makes output diffable, and the README examples are copy-pasteable. A TPM should expect ~30 minutes of onboarding documentation and one demo. The ramp-up cost that does matter is the wrapper's: whoever owns it needs working knowledge of PHPCS/PHPStan and WP-CLI packaging.
Bottom line. As a Laravel/PHP package, this is largely a category mismatch — treat it as a WordPress-only toolchain utility. Its defensible value is narrow but real: deterministic CPT/taxonomy registration and a battle-tested PHPUnit test harness for WordPress. Adopt it behind a thin internal wrapper, prohibit the deprecated block generator, and do not build anything on top of it that assumes continued upstream investment in plugin and theme scaffolding.
How can I help you explore Laravel packages today?