The Evolution of WordPress Software Development
Aki Björklund @akibjorklund
How do you organize your custom code?
I bet it is not pretty
WordPress offers no file/folder structure
WordPress offers no autoloading
WordPress offers no unit test framework
WordPress offers no dependency management
WordPress offers no [insert a “professional” software
development tool here]
Probably it shouldn’t either
There aren’t any plugins you can install to get those
There are plugin frameworks and some site frameworks
They are not widespread
…thus not suitable as basis of significant applications
We could roll our own… or not
What can we use then?
Create a solution out of existing widespread technologies
Solution like that is on a stable foundation
I’ll introduce to you our stack
Yours could be different
Bedrock gives us a project structure, but not for your own code
Composer gives us dependency management
Composer PHP autoloader will load files when they are needed
Symfony’s DependencyInjection component lets us write loosely
coupled code
PHPUnit and WP_Mock enable unit testing
WPlinth is our collection of base classes
About code organization
Site specific code lives in the mu-plugins folder
mu-plugins/app-loader.php
Example folder structure of the
application
/Connection /PostType /QueryFilter /Service /Taxonomy /Test Application.php
Classes inherit WPlinth base classes
Invest in some time to organize your code
No need to use all the tools mentioned here for all projects
Document your solution online
Let’s start building standards
Write code that you would gladly inherit from someone else
10 years from now
@akibjorklund
akibjorklund.com/2015/wceu for slides and more info