Base code for a WordPress plugin using PHP namespaces

I am writing more and more plugins for WordPress these days, and starting this year, I’ve begun submitting as many of the non-client-specific ones to the official WordPress Plugin Repository as I can.

Doing so has improved my coding quality no end. The thoughts that experienced programmers will be looking at my code, and that people will be using my plugins with no or little experience of coding, means that I go the extra mile to write clean code and document things properly.

Because a lot of the work I do in the day job is for TYPO3, I work with PHP namespaces a lot. I’ve found the advantages of this way of coding and have been using it in my WordPress code for the past couple of years. I wrote about the advantages back in September, as part of this easy introduction.

As an improvement to my workflow, I made a public Github repository in 2014 which contains my base code for a new plugin. It has just been completely re-written: the new version is much cleaner and contains version checks, to ensure that my plugins don’t break older WordPress installations. It also contains a much more extensive usage guide, alongside a basis version of the README file which is required when submitting to the WordPress Plugin Directory.

Feedback and comments are most welcome: the code and instructions are at https://github.com/markhowellsmead/wp-plugin-default.