Scaffold WordPress Plugins Instantly Using wp-plugin-init (Node.js CLI)

Build WordPress Plugins Faster with wp-plugin-init Boilerplate Creating a WordPress plugin from scratch can be time-consuming, especially when using modern tooling like Composer, Vite, Vue.js, and a robust OOP-based MVC structure. That’s where wp-plugin-init comes in — a complete plugin scaffolding tool published on npm, built to speed up your development and follow best practices. What is wp-plugin-init? wp-plugin-init is a Node.js CLI tool that generates a fully structured WordPress plugin boilerplate in seconds. It’s tailored for modern plugin development using: PHP OOP and PSR-4 Autoloading via Composer MVC architecture Vue.js (for interactive admin UI) Vite (as a modern asset bundler and hot module reloader) Ready-to-extend admin dashboard Automated namespace and file structure generation Features ✅ WordPress-ready file structure ✅ MVC directory separation (Controllers, Models, Views) ✅ PSR-4 compliant autoloading ✅ Vite-powered development for assets ✅ Vue.js ready for dynamic admin UI ✅ CLI automation for renaming namespaces, constants, menus, and plugin slugs ✅ Composer autoload update after setup Installation To use wp-plugin-init, install it globally: npm install -g wp-plugin-init Usage Simply run the command with your desired plugin name: wp-plugin-init suite-one This will: Create a new directory named suite-one Rename all placeholders (PluginsNameSpaces, constants, dashboard menu names) Set correct namespaces (SuiteOne\\) Replace plugin headers in the main file (suite-one.php) Run composer dump-autoload You’ll end up with a plugin that looks like: suite-one/ ├── app/ │ ├── Controllers/ │ ├── Models/ │ ├── Views/ │ ├── App.php │ └── AdminMenuHandler.php ├── composer.json ├── package.json ├── vite.config.js ├── public/ ├── resources/ │ └── js/ │ └── main.js ├── suite-one.php └── README.md What's Inside? PHP OOP Structure Your plugin logic is split into: Controllers/ – Manage logic and plugin actions Models/ – Handle data Views/ – Separate template rendering Composer Autoloading Namespaces are set dynamically based on your plugin name. After creation: namespace SuiteOne\Controllers; Composer’s autoload config is automatically updated. Vue.js + Vite Integration Your plugin is asset-ready out of the box. Inside resources/js/main.js, start building your Vue components. Vite handles bundling and live reload. npm install npm run dev During production: npm run build Smart Defaults & Automation wp-plugin-init auto-generates: Plugin headers Namespace structure Dashboard menu entries Constant definitions Vue/Vite asset paths No manual edits required — just start coding! Development Tips Use App.php for bootstrapping logic Place reusable components in app/ Run composer dump-autoload after adding new PHP classes Customize the admin dashboard from AdminMenuHandler.php Use Vue.js for dynamic forms or settings pages Example wp-plugin-init my-cool-plugin Creates: // Plugin header /* * Plugin Name: My Cool Plugin */ // Namespace usage use MyCoolPlugin\Controllers\DashboardController; Requirements Node.js (v14+) Composer PHP 7.4+ WordPress >= 5.8 License MIT – free to use and extend! Contribute Found a bug or want to improve the boilerplate? GitHub: github.com/Suite-Press/wp-plugin-init Pull requests welcome! Final Thoughts If you're tired of rebuilding boilerplates or piecing together modern workflows manually, wp-plugin-init is your perfect starting point. It saves time, enforces structure, and empowers you to focus on building features, not boilerplate. Start your next plugin with power, performance, and productivity — in one command.

May 4, 2025 - 08:49
 0
Scaffold WordPress Plugins Instantly Using wp-plugin-init (Node.js CLI)

Build WordPress Plugins Faster with wp-plugin-init Boilerplate

Creating a WordPress plugin from scratch can be time-consuming, especially when using modern tooling like Composer, Vite, Vue.js, and a robust OOP-based MVC structure. That’s where wp-plugin-init comes in — a complete plugin scaffolding tool published on npm, built to speed up your development and follow best practices.

What is wp-plugin-init?

wp-plugin-init is a Node.js CLI tool that generates a fully structured WordPress plugin boilerplate in seconds. It’s tailored for modern plugin development using:

  • PHP OOP and PSR-4 Autoloading via Composer
  • MVC architecture
  • Vue.js (for interactive admin UI)
  • Vite (as a modern asset bundler and hot module reloader)
  • Ready-to-extend admin dashboard
  • Automated namespace and file structure generation

Features

  • ✅ WordPress-ready file structure
  • ✅ MVC directory separation (Controllers, Models, Views)
  • ✅ PSR-4 compliant autoloading
  • ✅ Vite-powered development for assets
  • ✅ Vue.js ready for dynamic admin UI
  • ✅ CLI automation for renaming namespaces, constants, menus, and plugin slugs
  • ✅ Composer autoload update after setup

Installation

To use wp-plugin-init, install it globally:

npm install -g wp-plugin-init

Usage

Simply run the command with your desired plugin name:

wp-plugin-init suite-one

This will:

  • Create a new directory named suite-one
  • Rename all placeholders (PluginsNameSpaces, constants, dashboard menu names)
  • Set correct namespaces (SuiteOne\\)
  • Replace plugin headers in the main file (suite-one.php)
  • Run composer dump-autoload

You’ll end up with a plugin that looks like:

suite-one/
├── app/
│   ├── Controllers/
│   ├── Models/
│   ├── Views/
│   ├── App.php
│   └── AdminMenuHandler.php
├── composer.json
├── package.json
├── vite.config.js
├── public/
├── resources/
│   └── js/
│       └── main.js
├── suite-one.php
└── README.md

What's Inside?

PHP OOP Structure

Your plugin logic is split into:

  • Controllers/ – Manage logic and plugin actions
  • Models/ – Handle data
  • Views/ – Separate template rendering

Composer Autoloading

Namespaces are set dynamically based on your plugin name. After creation:

namespace SuiteOne\Controllers;

Composer’s autoload config is automatically updated.

Vue.js + Vite Integration

Your plugin is asset-ready out of the box. Inside resources/js/main.js, start building your Vue components. Vite handles bundling and live reload.

npm install
npm run dev

During production:

npm run build

Smart Defaults & Automation

wp-plugin-init auto-generates:

  • Plugin headers
  • Namespace structure
  • Dashboard menu entries
  • Constant definitions
  • Vue/Vite asset paths

No manual edits required — just start coding!

Development Tips

  • Use App.php for bootstrapping logic
  • Place reusable components in app/
  • Run composer dump-autoload after adding new PHP classes
  • Customize the admin dashboard from AdminMenuHandler.php
  • Use Vue.js for dynamic forms or settings pages

Example

wp-plugin-init my-cool-plugin

Creates:

// Plugin header
/*
 * Plugin Name:         My Cool Plugin
 */

// Namespace usage
use MyCoolPlugin\Controllers\DashboardController;

Requirements

  • Node.js (v14+)
  • Composer
  • PHP 7.4+
  • WordPress >= 5.8

License

MIT – free to use and extend!

Contribute

Found a bug or want to improve the boilerplate?

Final Thoughts

If you're tired of rebuilding boilerplates or piecing together modern workflows manually, wp-plugin-init is your perfect starting point. It saves time, enforces structure, and empowers you to focus on building features, not boilerplate.

Start your next plugin with power, performance, and productivity — in one command.