Your first plugin
As mentioned on the modular design page, using our framework usually makes sense when you use at least the first 3 modules (Bootstrapper, Helpers, and Foundations). Those are as general as we can humanly think of and they try to set literally no expectations on your project while simultaneously offering you all the abstractions you need (in the form of Interfaces, Traits, and Abstract Classes) to build your plugin the way you see fit.
If you only use only these 3 modules, there is a good chance there will be some unused files, but that shouldn't have any performance impact if you use the Composer autoloader (which for the rest of this documentation, we will definitely assume that you are).
There is an example plugin on GitHub that only uses the first 5 modules. It's meant as a sort-of starter project for adding custom code to client websites (basically a replacement for the classical
functions.php), but it can be easily used as a starter plugin as well.
We recommend that you download this plugin and use it as your starting base. This is a checklist of things you probably want to do after downloading the example plugin:
- 1.Rename the folder from
wordpress-plugins-utilityto the slug of your plugin.
- 2.Do a search for
DWS WordPress Utility Pluginand replace it with your plugin's name.
- 3.Similarly, make sure to update the plugin header in
README.mdand optionally change the minimum PHP and WP versions.
- 4.Change the Deep Web Solutions references in
- 5.Update the
composer.jsonfile to reflect the modules you really want to use. By default, the example plugin also installs
php-di/php-difor dependency injection and
monolog/monologfor logging but you are free to use your preferred packages.
composer update --ignore-platform-reqsand
npm updatein the plugin directory.
Congratulations! You are now ready to use start building a WordPress plugin using the DWS Framework. Continue reading the documentation of each module in order to understand how to use the framework effectively.