Personal WordPress plugin boilerplate
- Node.js with NPM
- Composer
- Clone the repository to your WordPress
wp-content/pluginsdirectory. - Update
nameanddescriptionofpackage.jsonto something more suitable to the plugin. - Update
nameanddescriptionofcomposer.jsonto something more suitable to the plugin. - Rename
wp-plugin-boilerplate.phpto a more appropriate name then modify the plugin header accordingly. - Update namespace from
Fsylum\Pluginto something more approriate in all files insrcfolder as well as theautoloadsection ofcomposer.json. - Run
composer dump-autoloadto regenerate the autoloader.
- This plugin is integrated with Laravel Mix, so you should be able to use
npx mix,npx mix watchandnpx mix --productionas usual. - All 3rd party dependencies are managed via Composer.
- New functionalities are added via
servicesthat extends theFsylum\Plugin\Contracts\Runnableinterface which is then register inside thewp-plugin-boilerplate.php. A few examples are included insrc/WPdirectory. - CLI commands are handled inside the
src/WP/CLIdirectory and registered inside thewp-plugin-boilerplate.php. An example is provided as reference.