A boilerplate for WordPress plugins (iWorks style): main file + PHP classes
(/includes/iworks) + options config (/etc/options.php) + assets built with
a bun bundler. New plugins are scaffolded from this stub — see below.
Requirements: Bun >= 1.3, PHP >= 8.1.
- get this repo:
git clone git@github.com:iworks/wordpress-plugin-stub.git - run
bun install(thepostinstallscript downloadswp-cli.phar) - run
bun run devto watch assets, orbun run buildfor a production build (both ZIPs:release/wporg/,release/github/)
- run
assets/bin/wp-plugin-create.sh 'Plugin Name' [slug]— clones the repo and renames everything (slug, class names, prefixes, placeholders) - inside the new plugin run
bun install && bun run build
- get
wordpress-tests-librepogit clone git@github.com:ArcFramework/wordpress-tests-lib.git - set environment variable
WP_TESTS_DIRto path towordpress-tests-librepo - configure
wp-tests-config.phpto usewordpress-tests-librepo - install PHPUnit Polyfills -
composer require --dev yoast/phpunit-polyfills:"^4.0" - set environment variable
WP_TESTS_PHPUNIT_POLYFILLS_PATHto path tophpunit-polyfillsdirectory - add some tests
- run
bun run test