Usage

Customize and build your WPZylos plugin using the Scaffold CLI.

Prerequisites

ToolRequiredNotes
PHP 8.0+Good: YesCheck with php -v
Composer 2.0+Good: YesCheck with composer -V
PowerShellWindowsPre-installed on Windows 10/11
BashUnixPre-installed on Linux/Mac; Git Bash for Windows

Running the Scaffold CLI

Option 1: PowerShell (Windows 10/11)

Open Windows PowerShell (search "PowerShell" in Start menu):

.\scaffold.ps1              # Interactive menu
.\scaffold.ps1 init         # Initialize plugin
.\scaffold.ps1 build        # Build for production

Option 2: Command Prompt (Windows)

Open Command Prompt (cmd.exe). Since .ps1 files don't run directly in cmd, use:

powershell -ExecutionPolicy Bypass -File scaffold.ps1
powershell -ExecutionPolicy Bypass -File scaffold.ps1 init
powershell -ExecutionPolicy Bypass -File scaffold.ps1 build

Option 3: Bash (Linux/Mac/Git Bash)

For Linux, macOS, or Git Bash on Windows (install Git for Windows):

chmod +x scaffold.sh        # Make executable (first time only)
./scaffold.sh               # Interactive menu
./scaffold.sh init          # Initialize plugin
./scaffold.sh build         # Build for production

Git Bash alternative: If ./scaffold.sh doesn't work, try bash scaffold.sh

Initialization

Running scaffold init prompts for:

PromptExampleDescription
Plugin NameMy Awesome PluginDisplay name
Plugin Slugmy-awesome-pluginLowercase, hyphenated
NamespaceMyAwesomePluginPascalCase PHP namespace
Scoper Prefixmy_awesome_pluginFor PHP-Scoper isolation
Database Prefixwpb_For DB tables and options
Author NameYour NamePlugin author

Namespace Support

You can use nested namespaces with backslashes:

MyAwesomePlugin                    # Simple
Starter\MyAwesomePlugin          # Vendor prefixed
MyCompany\WP\Bra\Calculator         # Deep nesting

Re-Configuration

The init script is intelligent - run it again to update values:

Current Configuration:
  Plugin Name:  My Awesome Plugin
  Slug:         my-awesome-plugin
  Namespace:    Starter\MyAwesomePlugin

You can update any value or press Enter to keep current.

> Plugin Name [My Awesome Plugin]:
  PHP Namespace [Starter\MyAwesomePlugin]: MyCompany\MyAwesomePlugin

Only changed values are replaced (others show "Skipped").

Configuration File

After init, .plugin-config.json stores your settings:

{
  "plugin": {
    "name": "My Awesome Plugin",
    "slug": "my-awesome-plugin",
    "namespace": "Starter\\MyAwesomePlugin"
  }
}

This file is used by scaffold build.

Building for Production

Option 1: PowerShell (Windows)

.\scaffold.ps1 build              # Full build with QA
.\scaffold.ps1 build -SkipQA      # Skip phpcbf/phpstan
.\scaffold.ps1 build -SkipScoper  # Dev build (no scoping)

Option 2: Command Prompt (Windows)

powershell -ExecutionPolicy Bypass -File scaffold.ps1 build
powershell -ExecutionPolicy Bypass -File scaffold.ps1 build -SkipQA
powershell -ExecutionPolicy Bypass -File scaffold.ps1 build -SkipScoper

Option 3: Bash (Linux/Mac/Git Bash)

./scaffold.sh build               # Full build with QA
./scaffold.sh build --skip-qa     # Skip phpcbf/phpstan
./scaffold.sh build --skip-scoper # Dev build (no scoping)

Build Pipeline

  1. Clean artifacts
  2. Run phpcbf (PSR12)
  3. Run phpstan
  4. Install production dependencies
  5. Run PHP-Scoper
  6. Create versioned ZIP in dist/

Next Steps