Tuesday, 7 March 2017

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 has lead to a number of issues. Wrapping (third party) PHP packages inside your own namespace is something some developers already started doing on their own. Mozart simplifies and automates this process.
Say you want to use the Pimple package in your WordPress plugin. This package runs from the Pimple namespace. What Mozart does, is convert the files from the Pimple package, to use your own namespace, CoenJacobs\TestPlugin\Pimple for example. Your plugin can then use this package, inside your own namespace, so you always use the exact version you want.
Dependency management issues
I’ve written a fair bit about dependency management when it comes to the WordPress ecosystem. Behind the scenes, I have been researching various ways to deal with the issue at hand. In case you missed it, WordPress offers no way to handle dependency
Source: https://managewp.org/articles/14528/mozart-monkey-patches-wordpress-lack-of-dependency-management

source https://williechiu40.wordpress.com/2017/03/07/mozart-monkey-patches-wordpress-lack-of-dependency-management/

No comments:

Post a Comment