Skip to content

GaryJones/plugin-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

294 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Plugin Boilerplate

Stable tag: 0.1.0
Requires at least: 6.9
Tested up to: 7.0
Requires PHP: 8.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: boilerplate
Contributors: garyj

Short summary about the plugin.

CI for Plugin Boilerplate

Description

Long description about the plugin.

Screenshots

Alt text for screenshot 1 HERE
Screenshot 1 caption HERE.

Installation

Upload

  1. Download the latest tagged archive (choose the "zip" option).
  2. Go to the PluginsAdd New screen and click the Upload tab.
  3. Upload the zipped archive directly.
  4. Go to the Plugins screen and click Activate.

Manual

  1. Download the latest tagged archive (choose the "zip" option).
  2. Unzip the archive.
  3. Copy the folder to your /wp-content/plugins/ directory.
  4. Go to the Plugins screen and click Activate.

See the WordPress documentation for more information about installing plugins manually.

Git

In a terminal, browse to your /wp-content/plugins/ directory and clone this repository:

git clone git@github.com:GaryJones/plugin-slug.git

Then go to your Plugins screen and click Activate.

Composer

composer require gamajo/plugin-slug

Updates

This plugin supports the Git Updater plugin (formerly known as GitHub Updater), so if you install that, this plugin becomes automatically updateable direct from GitHub.

Development

Prerequisites

Setup

composer install
npm install
npm run build
npx @wordpress/env start

npm scripts

JavaScript and CSS assets are built with @wordpress/scripts. Source lives in src/js; the compiled output and its generated *.asset.php dependency file land in build (git-ignored).

Script Description
npm run build Build the production assets into build.
npm run start Rebuild assets on change, with source maps.
npm run lint:js Lint the JavaScript.
npm run lint:css Lint the stylesheets.
npm run format Format the source files.

Composer scripts

Script Description
composer lint Lint PHP and XML files for syntax errors.
composer cs Check coding standards with PHPCS.
composer cs-fix Fix coding standards violations with PHPCBF.
composer test:unit Run the unit tests.
composer test:integration Run the integration tests inside wp-env.
composer test:integration-ms Run the integration tests against Multisite.
composer coverage Run the unit tests with a code coverage report.
composer infection Run mutation tests with Infection.
composer rector Check for automated refactoring opportunities with Rector.
composer phpstan Run static analysis with PHPStan.

FAQ

How do I use this boilerplate?

Search the codebase for plugin-slug, plugin_slug, PLUGIN_SLUG, PluginSlug and Plugin Boilerplate, and replace each with the equivalent names for your plugin.

Why is PHPUnit pinned to 9.6?

The integration tests extend WP_UnitTestCase, and the WordPress core test framework does not yet support anything newer than PHPUnit 9.6.

Why is composer.lock not committed?

This is a boilerplate, so consumers should resolve dependencies against their own constraints and commit their own lock file.

How are the JavaScript and CSS assets built?

src/js/admin-settings.js is bundled by @wordpress/scripts (run npm run build). The build emits build/admin-settings.js, an extracted build/admin-settings.css, and build/admin-settings.asset.php, which lists the script's WordPress dependencies and a content hash for cache busting. Plugin::enqueue_admin_assets() reads that file so neither the dependency list nor the version is maintained by hand. Built files are not committed; the deploy workflow runs the build so release archives are ready to install. Unlike composer.lock, package-lock.json is committed, so the build is reproducible.

Change Log

Please see CHANGELOG.md.

Contributing

See the contributing document.

Support

See the support document.

Licensing

The code in this project is licensed under GPL v2 or later.

Credits

Built by Gary Jones
Copyright 2024-2026 Gary Jones

About

WordPress plugin boilerplate: PSR-4, PHP 8.4+, wp-env integration tests, PHPCS (WPCS/VIPCS/PHPCompatibility), Infection mutation testing, Rector.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors