Solving plugin dependency

Ryan McCue and Gary Pendergast have differing viewpoints on plugin dependency and how to solve it (or whether to solve it at all). Watching them debate is music to my ears.

From Ryan:

Software is invariably never built in isolation (“no man is an island”), so they are naturally drawn to using external libraries. Extending an existing system is also extremely useful; we can see that from the plugin ecosystem in WordPress itself.

However, right now, there’s no good way to do these in a way that interoperates with other plugins and sites. There are various third-party solutions, but often these require code duplication or offer a substandard user experience.

and the basis for the solution:

Any PHP developer who has worked outside of WordPress recently will know Composer. Composer, for those who aren’t aware, is a command-line tool for managing dependencies in PHP. Composer is also not a good solution to the dependency problem for WordPress plugins: it requires CLI access and knowledge, it has a somewhat clunky interface and user experience (edit a JSON file, then generate a lock file and a vendor directory, then maybe commit one or more of those), and it also requires PHP 5.3+ (a non-starter for core integration, currently).

However, one of the key parts of Composer is the dependency solver, which is a port of the libzypp solver. This is a “SAT solver”: it takes note of what’s available and of what something requires, then it works out whether it can install the software (it solves the satisfiability problem). This solver is the key to working out the dependency chain for openSUSE packages (where libzypp is originally from), and the same system is used by Composer. This system would be a fantastic base for a plugin dependency system.

Then Gary trolls pretty hard. Asking himself how he's solve plugin dependency:

lol, I wouldn’t1.


1. If I absolutely had to, I wouldn’t do it the same as Ryan.

But then does go on to say how he'd approach it if necessary (the answer is with auto updates). But he notes he doesn't think it's the right approach:

I’m still not convinced plugin dependencies is a good thing to put in Core – it introduces significant complexities to plugin updates, as well as adding another dependency on WordPress.org to Core.

Both make good points. This is a topic I'd really love to see more of. Ryan also makes an open call for folks willing to try his idea some more to do so, as he doesn't have time.

Similar Posts