Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/emranahmed/storepress-base-plugin/archive/refs/heads/main.zipUpdates itself. It ships its own updater (Update URI header), so new versions appear under Dashboard → Updates.
Download latest release | Test the plugin in your browser using Playground.
Summary table
| Question | Yes → Directory | ServiceProvider behaviour |
|---|---|---|
| Extends an external package (functional)? | Adapters/ |
— no own provider |
| Extends an external package (core infra like implement interface)? | Integrations/ |
— no own provider |
| Has WordPress hooks that must fire on boot? | Features/ |
register() + boot() |
| No hooks — resolved on demand? | Services/ |
register() only |
| Is an individual service provider? | ServiceProviders/ |
— is the provider |
| Orchestrates all service providers? | Core/ |
— boots ServiceProviders/ |
| Shared utility across classes? | Traits/ |
— no provider |
Why the difference matters:
boot()is what triggers hook registration — it resolves the class from the container, which runs its constructor and firesadd_action/add_filter. A Feature must be booted eagerly so its hooks are live before WordPress needs them.- A Service has no hooks. It does not need to be resolved at boot time — the container holds the binding and resolves it lazily the first time something calls
get_settings()or$container->get(Settings::class). Callingboot()on a hookless class is unnecessary work.
First
git clone https://github.com/EmranAhmed/storepress-base-plugin.gitnpm inpm run packages-update- Update WordPress packagescomposer update && composer dump-autoload- Update WordPress packages
Where to change
- Create test for wp only
bash bin/install-wp-tests.sh storepress_base_plugin_test root 'PASSWORD' localhost latest - Create test for with wc
bash bin/install-wp-tests-with-wc.sh storepress_base_plugin_test root 'PASSWORD' localhost latest - Open all files from
includesdirectory and change namespace fromnamespace StorePress\Base;tonamespace Your_Company\Your_Plugin;. - Open
storepress-base-plugin.phpand change plugin header, text-domain, namespace, defined ConstantSTOREPRESS_BASE_PLUGIN_FILE, function name. - Open
includes/Plugin.phpand changeSTOREPRESS_BASE_PLUGIN_FILEonfunction get_plugin_file()function. - Open
storepress-base-plugin.phpto your plugin file name. - Rename
storepress-base-plugin.phpto your plugin file name. - Open
eslint.config.jsand changeallowedTextDomain: ['storepress-base-plugin'], - Open
composer.jsonand changename,description,autoload - Open
package.jsonand changenameas plugin file name,description,repository. - Open
phpcs.xmland change<rule ref="WordPress.NamingConventions.PrefixAllGlobals">,<property name="text_domain" value="storepress-base-plugin"/> - Open
package.jsonand changefilesfor package files. - Test example
- Gutenberg test example
Develop
npm start
Create New Block(s)
npm run create-dynamic-block [block name]- To add dynamic blocknpm run create-static-block [block name]- To add static block
Lint
npm run lint:js- Lint Javascriptnpm run lint:js:report- Lint Javascript and will generatelint-report.html. From terminalopen lint-report.htmlnpm run lint:css- Lint CSSnpm run lint:css:report- Lint CSS and will generatescss-report.txtfile.npm run lint:php- PHP Lint.npm run lint:php:report- PHP Lint report generate onphpcs-report.txt.npm run stan:php- PHP Stan.npm run stan:php:report- PHP Stan report onphpstan-report.txtfile.
Fix
npm run lint:js:fix- Fix Javascript Lint Issue.npm run lint:css:fix- Fix SCSS Lint Issue.npm run lint:php:fix- Fix PHP Lint Issue.
Format
npm run format:js- Format Javascriptnpm run format:css- Format SCSSnpm run format:php- Format PHPnpm run format- Format./src
Test
- How to add automated unit tests to your WordPress plugin
npm run test:unit- JS Unit testnpm run test:e2e- E2E testnpm run test:php- PHP Unit test
Release
npm run plugin-zip- make zip based onpackage.jsonfileslist.npm run package- make directory based onpackage.jsonfileslist.
Release to GitHub.com
git tag $(node -p "require('./package.json').version") && git push origin "$_"Publish Taggit tag -d $(node -p "require('./package.json').version") && git push origin --delete "$_"- Delete Tag
Provide your own translations
npm run language- Make POT File- Then follow this link to test
- Check translation guide