wpconstructor/scripts

WPConstructor Scripts: Composer-driven PHP scripts for building, backing up, and distributing WordPress plugins consistently and safely.

Maintainers

Package info

github.com/WPConstructor/scripts

pkg:composer/wpconstructor/scripts

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-04-01 13:36 UTC

This package is auto-updated.

Last update: 2026-04-01 13:37:14 UTC


README

WPConstructor Scripts Logo

A collection of Composer-driven PHP scripts for building, backing up, and distributing WordPress plugins consistently and safely.

Why I Built WPConstructor Scripts

While building WordPress plugins, I kept repeating the same Composer scripts—copying assets, creating ZIPs, backing up files, and securing directories. It became repetitive and error-prone.

So I built WPConstructor Scripts: a reusable setup that handles all the common plugin build tasks in one place, instead of rewriting them every time.

Installation

Install WPConstructor Scripts via Composer as a dev dependency:

composer require wpconstructor/scripts --dev

Then, add the following to your plugin’s composer.json under the "scripts" section:

"scripts": {
    "build:update": "php vendor/wpconstructor/scripts/scripts/build-vendor.php && php vendor/wpconstructor/scripts bin/copy-assets.php && php vendor/wpconstructor/scripts/scripts/add-index-php.php && npx @wpconstructor minify-assets assets",
    "build": "php vendor/wpconstructor/scripts/bin/run-build.php",
    "cfp": "php vendor/wpconstructor/scripts/bin/cfp.php",
    "clean": "php vendor/wpconstructor/scripts/bin/clean.php",
    "backup:packages": "php vendor/wpconstructor/scripts/bin/backup-packages.php",
    "backup:plugin": "php vendor/wpconstructor/scripts/bin/backup-plugin.php",
    "backup:all-plugins": "php vendor/wpconstructor/scripts/bin/backup-all-plugins.php"
}

Usage Examples

Asset & Security Helpers

  • Build Update
composer run build:update

Updates plugin assets to the correct directories, creating nested folders like:
assets/wpconstructor/dashboard/images.

  • Add Index Files (included in build)
    Automatically adds index.php to all asset directories to prevent directory listing.

Build & Distribution

  • Build Plugin
composer run build

Runs the full build process:

  1. Copies vendor files to dist-vendor
  2. Removes empty directories
  3. Adds index.php files
  4. Creates a distributable ZIP in dist/plugin-name-version-date.zip
  • Clean Project
composer run clean

Removes empty directories and cleans build artifacts.

Maintenance Utilities

  • Check File Permissions
composer run cfp

Scans your WordPress installation for files without write permissions.

Backup Scripts

  • Backup Current Plugin
composer run backup:plugin

Creates a backup of the current plugin in wordpress-root/../plugin-backups.

  • Backup All Plugins
composer run backup:all-plugins

Backs up all plugins to wordpress-root/../all-plugins-backup.

Optional:

composer run backup:all-plugins -- --only-wpconstr
  • Backup Packages Directory
composer run backup:packages

Backs up the entire packages directory to wordpress-root/../packages-backup.

One Workflow, Everywhere

With WPConstructor Scripts, every plugin build looks the same:

  1. Assets copied
  2. Vendors trimmed
  3. Empty directories removed
  4. Index files added
  5. ZIP created
  6. Backups secured

No guessing. No half-forgotten steps. No copy-pasting scripts between repos.

License

MIT License © 2026 by WPConstructor