Finding the perfect WordPress development workflow is hard, especially if you’re a plugin developer. Most tools available assume that you’re building out a full WordPress site at best and far too many of those leave out critical aspects of workflow such as debugging tools, performance tools and more.
I’ve spent most of the last decade working on this problem. From Primary Vagrant to WP Engine’s DevKit (which is no longer available) and a host of projects in and around both I’ve been rather obsessed with the perfect workflow.
What makes the perfect workflow?
- It has to be reproducible. This means that I don’t want to spend hours or more spinning it up on a new computer of my own and I want to be able to easily share it with any team I might be working with.
- It has to be plugin-centric. I’m rarely building full sites. I’m building plugins. This means that, in most cases, WordPress core is a dependency, not the primary package and this should be reflected in my development environment.
- It should be flexible. I want to test plugins in multiple PHP versions and other variations on my environment. More importantly, I want to be able to build other projects, whether WordPress or something else, without having to build out completely new tooling. I jump between far too many projects to want to deal with learning a different tool for each so this is key.
Given these requirements, I’ve developed a starter WordPress plugin that uses Lando and Visual Studio Code to get started building a plugin fast and, once started, can simply be checked out on any of my computers so I can continue development in a matter of a few minutes, no matter where I am.
Clone my starter plugin here
Getting started with my starter plugin
To get the most out of my starter plugin you’ll want to download and install 3 dependencies on your workstation:
Once installed, clone the starter plugin
git clone https://github.com/ChrisWiegman/wordpress-plugin-starter.gitCode language: Bash (bash)
Then switch to the directory
cd wordpress-plugin-starterCode language: Bash (bash)
And setup your site
make -s startCode language: Bash (bash)
The first start will take a few minutes but, when it’s done, you should be able to access your development site at wordpress-plugin-starter.lndo.site.
Features of the starter plugin
- Xdebug with Visual Studio Code integration built-in
- All plugin code can be developed in the
plugin/sub-folder of the project. No sorting project and other files
- A PHP autoloader to make loading all your plugin classes easy
- Unit testing with PhpUnit along with a starter test
- PHP_Codesniffer with WordPress sniffs pre-configured
- Debug Bar and Query Monitor are automatically installed and configured
- Deploy your plugin by simply deploying the
pluginfolder. No cleanup required
- Add your own plugin dependencies easily such as WooCommerce or others
- Test email sending in your plugin with Mailhog
- All features can be easily triggered or modified with Make
Sound good? The only thing you’ll need to do for your own project is change the names throughout the code and you’re good to go.