A GitHub template repo for starting a WordPress plugin built on PHPNomad. It ships with a wired PHPNomad Application (DI container, WordPress integration, event bindings) and a PHPScoper configuration that prefixes vendor and source namespaces at build time.
The PHPScoper step matters because WordPress loads every active plugin into the same PHP process. Two plugins that both ship phpnomad/core would otherwise collide on shared class names. This template rewrites your plugin's dependencies into a plugin-specific namespace, so your code can coexist with any other plugin that happens to use the same libraries.
From the GitHub UI, click the Use this template button at the top of the repository page and create a new repo under your account or organization.
From the command line, use the gh CLI:
gh repo create my-plugin --template phpnomad/wp-plugin-template --public --clone
cd my-plugin
composer installOnce the repo is cloned and dependencies are installed, customize the placeholder namespaces and plugin metadata.
- Replace the
PluginNameReplaceMenamespace throughoutsrc/andcomposer.jsonwith your plugin's own namespace. - Replace the
PluginNameReplaceMeDependencynamespace inscoper.inc.phpwith a unique prefix for your plugin's scoped dependencies. - Update the plugin header in
plugin.php(Plugin Name, Description, Author, Version). - Set the
namefield incomposer.jsonto your package name.
If your plugin does not need the WooCommerce Action Scheduler, remove the require_once 'libraries/action-scheduler/action-scheduler.php'; line from plugin.php and delete the submodule entry from .gitmodules.
plugin.php: WordPress plugin entry file. Callsinit()on every load andinstall()when the plugin is activated.src/Application.php: DI container and Bootstrapper wiring for PHPNomad Core, the WordPress integration initializer, and your plugin's own Core initializer.src/Core/Initializer.php: Example event binding that fires a PHPNomadReadyevent when WordPress runs itsinitaction.scoper.inc.php: PHPScoper configuration that prefixesvendor/andsrc/with a plugin-specific namespace.composer.json: Declares the PHPNomad dependencies (phpnomad/core,phpnomad/wordpress-integration) andhumbug/php-scoperfor the prefixing build step.setup.sh: Helper script that runscomposer installand registers the Action Scheduler submodule.libraries/action-scheduler: Git submodule pointing at WooCommerce's Action Scheduler, included for plugins that need deferred work.
Released under the MIT license. See LICENSE.txt.