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 ComposerViteVue.js, and a robust OOP-based MVC structure. That’s where `wp-plugin-init` comes in — a complete plugin scaffolding tool published on [npm](https://www.npmjs.com/package/wp-plugin-init), 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:

```bash
npm install -g wp-plugin-init
```

Usage

Simply run the command with your desired plugin name:

```bash
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:

```php
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.

```bash
npm install
npm run dev
```

During production:

```bash
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

```bash
wp-plugin-init my-cool-plugin
```

Creates:

```php
// 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](https://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.

Leave a Reply

Your email address will not be published. Required fields are marked *