1

I have a Framework 1.0 version git repo which is required via composer on my main Plugin.

All work fine but once I create a second plugin that will use the 1.1 version of my Framework, how can I make Plugin A use the latest Framework 1.1 that came bundled with Plugin B?

In other words, I need all my plugins to use the latest version of the Framework found in one of my plugins. I cannot seem to find a definite answer on how to achieve this within WordPress.

Keep in mind that whatever hack/code might be used, need to be passed by the WordPress.org folks in order to get the plugin active and not violate any of their rules.

Thanks

0

This is serious problem with WordPress and composer. Whatever you do, you are just asking for future problems and/or making life hard for your plugin users. Guess what - even if you manage to load correct version of framework for all your plugins, WP user may unknowingly install some other plugin, which also uses the same framework, but completely different version. And it could get loaded first and be incompatible with your plugins. Those plugins may even not use the same framework, just some other composer libraries, but most of composer libs require lot of other dependencies, and those may easily be conflicting versions.

It's hypothetical and probability of this actually happening might be quite low, just because most of plugins avoid using composer. But this is also reason why.

To better understand problem, read this and also linked/mentioned articles.

My best advice, if you absolutely need to use framework library, just move it to your own namespace using tools like php-scoper. This way each of your plugins will use their own isolated framework (and their dependencies) versions and will be safe from conflicts with any other plugins using composer.

  • I agree that this is a problem without a good solution, other than some variation of what you said. – Joel M Jan 31 '20 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.