Skip to content

One command creates everything: Full WordPress installation + Your custom plugin + Development environment + All dependencies installed + Assets built + Ready to code in < 3 minutes

License

Notifications You must be signed in to change notification settings

ChrisRArendt/create-wp-plugin

Create WP Plugin

npm version License: GPL v2 Tests Node Version

One command creates a complete WordPress development environment with your custom plugin, ready to code in minutes.

Quick Start

npx github:ChrisRArendt/create-wp-plugin

Answer a few questions about your plugin, and you'll get:

  • Full WordPress installation (latest version)
  • Your custom plugin scaffolded and activated
  • Development environment running (Lando + Docker)
  • Modern build pipeline (Webpack)
  • Testing framework (PHPUnit + Jest)
  • Code quality tools (PHPCS, PHPStan, ESLint)

Setup time: ~3 minutes from command to coding.

What You Get

Complete Development Environment

The generator creates a full WordPress installation with your plugin already integrated:

  • WordPress: Latest version, installed and configured
  • Lando: Containerized environment with PHP, MySQL, phpMyAdmin, MailHog
  • Build Pipeline: Webpack with hot reloading for development
  • Testing: PHPUnit for PHP, Jest for JavaScript
  • Code Quality: PHPCS (WordPress standards), PHPStan (level 8), ESLint, Prettier
  • CI/CD: GitHub Actions workflows ready to use

Project Structure

your-project/
├── wordpress/               # Full WordPress installation
├── plugin/                  # Your plugin source code
│   ├── src/                 # PHP classes (PSR-4 autoloaded)
│   │   ├── Plugin.php
│   │   ├── Admin/
│   │   ├── Frontend/
│   │   └── Integrations/
│   ├── assets/
│   │   ├── src/             # JavaScript & SCSS source
│   │   └── dist/            # Built assets
│   ├── tests/
│   │   ├── php/             # PHPUnit tests
│   │   └── js/              # Jest tests
│   ├── composer.json
│   ├── package.json
│   └── webpack.config.js
└── .lando.yml              # Development environment config

Optional Integrations

Choose what you need during setup:

  • Elementor: Custom widget boilerplate
  • Advanced Custom Fields: Field groups and blocks
  • Gutenberg: Custom block examples
  • WooCommerce: Integration templates
  • REST API: Endpoint examples
  • Alpine.js: Reactive components

Usage

Interactive Setup

npx github:ChrisRArendt/create-wp-plugin

You'll be prompted for:

  • Project name and folder
  • Plugin details (name, description, author)
  • Company name (used for namespaces and URLs)
  • WordPress and PHP versions
  • Which integrations and features to include

Development

cd your-project

# Start WordPress environment
lando start

# Watch and rebuild assets (in another terminal)
cd plugin
npm run dev

# Your site is ready
# https://your-project.lndo.site
# https://your-project.lndo.site/wp-admin

Available Commands

lando wp              # WP-CLI
lando composer        # Composer
lando npm             # npm
lando build           # Build production assets
lando dev             # Watch mode
lando phpcs           # Check PHP standards
lando phpstan         # Static analysis
lando phpunit         # Run PHP tests
lando test            # Run all tests

Features

Modern Architecture

  • PSR-4 autoloading with Composer
  • Modern PHP 8.0+ features and type hints
  • Object-oriented plugin structure
  • Namespaced code
  • Dependency injection ready

Code Quality

PHP:

  • WordPress Coding Standards (PHPCS)
  • PHPStan at level 8
  • PHPUnit with code coverage

JavaScript:

  • ESLint with WordPress config
  • Prettier formatting
  • Jest testing
  • Babel transpilation

CI/CD

Generated projects include GitHub Actions that:

  • Run tests on push and pull requests
  • Test multiple PHP versions (8.0-8.3)
  • Test multiple WordPress versions
  • Create releases automatically on git tags
# Release workflow
git tag v1.0.0
git push origin v1.0.0
# GitHub Actions builds and releases

Stays Current

The generator pulls the latest versions when you run it:

  • Latest WordPress version
  • Current PHP recommendations
  • Up-to-date npm packages
  • Fresh Docker images

Run it today or in 5 years—you'll get a modern setup.

Examples

Minimal Plugin

$ npx github:ChrisRArendt/create-wp-plugin

? Plugin name: Simple Widget
? JavaScript approach: vanilla
? Integrations: (none)

# Clean, minimal plugin

Full-Featured

$ npx github:ChrisRArendt/create-wp-plugin

? Plugin name: Advanced Plugin
? JavaScript approach: both
? Integrations: elementor,acf,gutenberg
? Features: rest-api,custom-post-types

# Complete plugin with all integrations

Testing

The generator itself has comprehensive tests:

  • Unit Tests (27): Core logic and functions
  • Template Validation (48): File integrity and placeholders
  • Integration Tests (31): Full project generation
  • E2E Tests (CI): Real WordPress environment

Total: 106 tests

# Run all tests
./scripts/test-local.sh

# Specific suites
npm run test:generator:unit
npm run test:generator:validation
npm run test:generator:integration

See docs/TESTING.md for details.

FAQ

Can I use this with existing WordPress?
No, it creates a fresh WordPress install. Copy the generated plugin folder to any WordPress site.

Do I need to know Lando/Docker?
No. Just have them installed—the template handles configuration.

Can I modify the generated code?
Yes, it's your code. Modify anything.

Works on Windows/Mac/Linux?
Yes, wherever Docker runs.

How do I deploy?
Run npm run build in the plugin folder, then ZIP it. Or use the GitHub Actions release workflow.

Troubleshooting

"Lando not found"
Install from lando.dev

"Docker not running"
Start Docker Desktop.

"Port already in use"

lando poweroff

Plugin won't activate
Check logs with lando logs. Common fixes:

  • lando composer install
  • lando rebuild -y

Assets not building

cd plugin
npm install
npm run build

Need help?

Requirements

  • Node.js 24.x (LTS)
  • Lando 3.x+
  • Docker (running)
  • Composer 2.x (optional)
  • Git (recommended)

Documentation

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

GPL v2 or later

Credits

Created by Christopher Arendt

Built with:


Happy coding!

About

One command creates everything: Full WordPress installation + Your custom plugin + Development environment + All dependencies installed + Assets built + Ready to code in < 3 minutes

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published