Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-wp-plugin

Interactive scaffold generator for modern, production-ready WordPress plugins — built with PSR-4 autoloading, WPCS/VIP coding standards, PHPUnit unit tests, WP-CLI command integration, and optional React asset build pipeline (@wordpress/scripts).

Usage

Quick Start via NPX

Run directly without installing:

npx create-wp-plugin-cli

Published on npm as create-wp-plugin-cli (the create-wp-plugin name was already taken). You can still run the latest main branch directly from GitHub with npx github:akshat009/create-wp-plugin.

Local Usage

node index.js

CLI Flags (Non-Interactive Mode)

node index.js --yes --name "My Plugin" --prefix myp --namespace MyPlugin --out ./my-plugin

Available flags: --help, --version, --yes, --name, --slug, --namespace, --prefix, --author, --email, --author-uri, --description, --min-php, --out, --modules, --react, --no-react.

--modules accepts a comma-separated list of: admin_settings, shortcode, rest_api, ajax_handler, cpt_taxonomy, cron, elementor_widget, woocommerce_hooks, interactivity.

After Generating

After running the generator, perform the following steps to initialize your project:

cd <slug>
composer install        # installs PHPCS/WPCS/VIP rulesets, PHPUnit (required
                        # before composer lint / composer test will work)
composer lint
composer test
git init && git add -A && git commit -m "scaffold"

Note: composer install may prompt to allow the dealerdirect/phpcodesniffer-composer-installer plugin — answer yes, as it registers the WPCS/VIP rulesets with PHPCS. You may also see a message "No composer.lock file present" on the first run; this is completely normal and Composer will automatically create the lock file.

Features

  • PSR-4 Autoloading: Clean src/ directory layout with automatic fallback.
  • 🎨 WordPress Coding Standards: Full WPCS, Docs, VIP Go, and PHPCompatibilityWP integration (composer lint).
  • 🧪 PHPUnit & Brain Monkey: Zero-WordPress-install unit testing suite (composer test).
  • 💻 WP-CLI Commands: Built-in wp <prefix> status and wp <prefix> cache clear handlers.
  • ⚛️ React Admin App Build Pipeline: Built-in @wordpress/scripts workflow that mounts a real interactive React app into your plugin's own wp-admin screen (not shipped to frontend visitors).
  • Frontend Interactivity Module: WordPress's native Interactivity API (directive-based, WP 6.5+) for lightweight, actually-interactive frontend markup without shipping a React runtime to visitors.
  • 📦 Modular Architecture: Toggleable scaffolding for Admin Settings Page, Shortcodes, REST API, AJAX, CPT + Taxonomies, Cron Jobs, Elementor Widgets, WooCommerce, and Frontend Interactivity.
  • 🛒 Full WooCommerce Integration: Payment gateway (classic checkout and WooCommerce Blocks / block-based checkout), shipping method, custom order email (with its own template files), custom product type, HPOS compatibility — all real, working, PHPCS-clean skeletons, not stubs you have to wire up yourself.
  • 🔌 Service Composition: Extensible {{PREFIX}}_services filter to inject third-party Registrable services.
  • 🎨 Elementor Auto-Discovery: Automatic discovery of concrete widgets in src/Widgets/ with convention-based CSS/JS registration ({{PREFIX}}-widget-slug).
  • 🛠️ VS Code Tooling: Code snippets (wpelwidget), PHPCS integration (valeryanm.vscode-phpsab), EditorConfig support, and WordPress stubs via Intelephense.
  • ⚙️ GitHub Actions CI: Preconfigured workflow for automated PHPCS linting and PHP version matrix testing.

Note: To scaffold Gutenberg blocks, use npx @wordpress/create-block.

License

GPL-2.0-or-later

About

Interactive scaffold generator for modern WordPress plugins — PSR-4, WPCS/VIP standards, PHPUnit, WP-CLI, CI out of the box

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages