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

Transparency log

Statistics

Installs: 98

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-07-04 16:33 UTC

This package is auto-updated.

Last update: 2026-07-04 17:26:23 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": "php vendor/wpconstructor/scripts/bin/run-build.php",
    "cfp": "php vendor/wpconstructor/scripts/bin/cfp.php",
    "backup:plugin": "php vendor/wpconstructor/scripts/bin/backup-plugin.php",
    "backup: all-plugins": "php vendor/wpconstructor/scripts/bin/backup-all-plugins.php"
}

Create a build-zip.manifest.json file in the root of your plugin. The base value should match your plugin's slug (the root directory inside the ZIP). Use the include array to specify which files and directories should be packaged, and add-index-php to automatically create index.php files in the listed directories for additional directory protection.

Example:

{
    "base" : "wpcn-contact",
    "zip-file-name" : "wpcn-contact.zip",
    "include":[
        "/wpcn-contact.php",
        "/README.md",
        "/LICENSE.md",
        "/src/",
        "/docs/",
        "/assets/",
        "/vendor/wpconstructor/plugin-version/src/includes/plugin-version.php",
        "/vendor/autoload.php",
        "/vendor/composer/"
    ],
    "add-index-php":[
        "/"
    ]
}

Usage Examples

Build & Distribution

  • Build Plugin
composer run build

Creates a distributable ZIP in build/plugin-slug.zip, as defined in build-zip.manifest.json.

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.

Changelog

v0.2.0 (July 4, 2026)

  • Added support for build-zip.manifest.json, enabling configurable and structured plugin ZIP builds.

v0.1.0 (April 1, 2026)

  • Initial version used for the WPConstructor Dashboard (now removed).

License

MIT License © 2026 by WPConstructor