Decouple from WordPress databases by using repositories

A quick and easy way to decouple your code from WordPress logic, is by using repositories. Repositories are standardized ways to get and put data in a data store, usually databases. WordPress introduces a couple functions to interact with various database tables (get_post_meta(), get_option(), etc.) that are commonly used inside plugin and theme files, that […]

Class constructors should only setup the object

It’s common practice in the larger PHP world, but something the WordPress ecosystem has yet to catch up on. All too often, I see WordPress plugins and themes setup actions, filters and use other WordPress specific functions in class constructors. This leads to a class that is directly coupled to WordPress logic.

Mozart monkey patches WordPress’ lack of dependency management

A first proof of concept version of Mozart is now available for public testing. Mozart is a command line tool for wrapping PHP packages inside your own namespace. This is the least bad solution for solving most dependency management issues inside the WordPress ecosystem. The fundamental lack of dependency management support inside the WordPress ecosystem […]

Bundling libraries is not overhead, it’s a best practice

It’s been a while since I last posted something about the whole dependencies horror that I’m still trying to deal with in the WordPress ecosystem. Justin Sternberg’s post on the future of the CMB2 library got the discussion going again and soon after, we were at the dependencies discussion again. It was mainly the discussion […]

Video of my Love-Hate Relationship Between Composer and WordPress presentation

The video of my presentation about the Love-Hate Relationship Between Composer and WordPress at WordCamp Netherlands this year has been published on WordPress.tv: You can find the slides on Speakerdeck. It was a great audience with some really good questions that have given me plenty of food for thought regarding the whole subject. It’s too […]

Explaining the WordPress plugins dependencies problem

There is a lot of confusion in the WordPress ecosystem when it comes to the issues around bundling dependencies. Peter Suhm has published a detailed post about this exact issue: A Warning About Using Composer With WordPress, where I have left the following (partial) comment: So imagine both of us loading library x in our plugins, both […]

Solving dependency management in WordPress plugins

I’ve been working on a proof of concept for solving dependency management in WordPress plugins for a while now. It was in a private repository on GitHub, where I would invite some people in to work out the most obvious issues, while keeping it a bit on the down-low (this is a big change, potentially, […]