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 [email protected]:janw-me/janw-plugin-base.git .
rm -rf .git
git init
Checkout the branches for features possible needed to setup.
Before actual starting there are several places that need to be renamed, This will rename most things:
mv janw-plugin-base.php your-slug.php
mv languages/janw-plugin-base-nl_NL.po languages/your-slug-nl_NL.po
find ./ -type f -not -path "./.git/*" -exec sed -i 's/janw-plugin-base/your-slug/g' {} \;
find ./ -type f -not -path "./.git/*" -exec sed -i 's/JANW_PLUGIN_BASE/YOUR_SLUG/g' {} \;
find ./ -type f -not -path "./.git/*" -exec sed -i 's/Janw\\Plugin_Base/Your\\Slug/g' {} \;
composer.json- name (the user should probably change)
- description
- packages (yes please double check)
readme.txt- line 1: with plugin title
.phpcs.xml.dist- prefixes
- text_domain
janw-plugin-base.php- rename file (should have been done automatically)
- Check all plugin headers
- Plugin wide seach-replace
- Constants: JANW_PLUGIN_BASE
- Namespace & Package: Janw\Plugin_Base
- clear this section and the install section.
Default is set to 8.2, to update it change:
janw-base-plugin.phpcomposer.json(2 places).phpcs.xml.distreadme.txtphpstan.neon.distphpcs-fixer.dist.php
The default is 6.6, to update is change:
janw-base-plugin.php.phpcs.xml.distreadme.txt
Inside composer several extra tools have been added:
Code formatting:
composer run phpcbfRun the phpcbf, an autoformatter.composer run phpcsRun phpcs, Checks style and syntax agianst theh WordPress coding stadard.composer run lintRun php linter, Checks syntax.composer run phpstanRun phpstan, Checks styntax, docblock, non existing functions/classes.composer run ciRun all the above syntax checkers at once.
Creating plugin zip:
composer run createzipWill create a zip named 'plugin-slug.zip' in the plugin folder.composer run createzip-in-downloadsWill create a zip named 'plugin-slug-0.1.0.zip' in the plugin folder.composer run createzip-with-versionWill create a zip named 'plugin-slug-0.1.0.zip' in the Downloads folder.