This is my starter plugin that I use for every project.
Clone this repo in an empty directory, remove the git and start your own git.
git clone git@github.com:janw-me/janw-plugin-base.git .
rm -rf .git
git init
See examples/ for ready-to-copy feature patterns (settings page, AJAX, cron) and AGENTS.md for the project conventions.
Rename the boilerplate for your project with the bundled script (run once, from the plugin root):
composer setup -- --name "My Plugin" --slug my-plugin --namespace "Acme\\My"
# or call it directly:
bin/setup.sh --name "My Plugin" --slug my-plugin --namespace "Acme\\My"
This replaces every placeholder (slug, constants, namespace, function/hook prefixes, plugin name),
renames the main file and the language file, resets the git history to a single initial commit,
and then removes itself. Run bin/setup.sh --help to
see the optional flags (--prefix, --short-prefix, --const-prefix, --description).
Afterwards:
- Review
composer.json— thejanw-mevendor name and the devpackages(double-check them). - Review the plugin header in
<your-slug>.phpand the title line inreadme.txt. - Remove this Installing / Setup section.
- Run
composer install && composer ci && composer test.
See AGENTS.md for the project conventions and day-to-day commands.
Default is set to 8.2, to update it change:
janw-plugin-base.phpcomposer.json(2 places)phpcs.xml.distreadme.txtphpstan.neon.distphpcs-fixer.dist.php
The default is 6.6, to update is change:
janw-plugin-base.phpphpcs.xml.distreadme.txt
Inside composer several extra tools have been added. See AGENTS.md for the full development loop.
Code quality (the toolchain is rector → php-cs-fixer → phpcbf → phpcs → phpstan):
composer ciRun the whole toolchain on every file.composer ci:changedRun the whole toolchain on changed files only.composer phpcbfRun phpcbf, the WordPress-standard autoformatter.composer phpfixerRun php-cs-fixer, the secondary autoformatter.composer phpcsRun phpcs, checks style against the WordPress Coding Standard.composer phpstanRun phpstan, static analysis (types, docblocks, unknown symbols).composer phprectorRun rector, automated refactors.
Tests:
composer testFast PHPUnit unit suite (no WordPress, no database).composer test:installInstall the WordPress test library (run once beforetest:wp).composer test:wpWordPress integration suite (needstest:install).
Creating a plugin zip:
composer createzipCreateplugin-slug.zipin the plugin folder.composer createzip:downloadsCreateplugin-slug-0.1.0.zipin~/Downloads.
Versioning & release:
composer bumpversion:patch|minor|majorRun CI, then bump the version everywhere.composer publish-versionCommit, tag, and push the new version.