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:
Rename the folder from
wordpress-plugins-utilityto the slug of your plugin.Do a search for
DWS WordPress Utility Pluginand replace it with your plugin's name.Similarly, make sure to update the plugin header in
bootstrap.phpandREADME.mdand optionally change the minimum PHP and WP versions.Change the Deep Web Solutions references in
composer.jsonandpackage.json.Update the
composer.jsonfile to reflect the modules you really want to use. By default, the example plugin also installsphp-di/php-difor dependency injection andmonolog/monologfor logging but you are free to use your preferred packages.Do a search for
DWS_Depsand replace it with a unique name for your plugin. For example, we're usingDWS_LPM_Depsfor our Locked Payment Methods plugin.Run
composer update --ignore-platform-reqsandnpm 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.
Last updated
Was this helpful?