Is there any performance difference between duplicating composer packages among multiple plugins and not doing it? How can I avoid it?
The whole point of PHP Composer is to handle dependencies in a clean way, so that developers don’t need to care about duplication, updates, and instantiating the necessary classes when needed.
But there is a case within WordPress, in which I don’t understand what goes on with the part that corresponds to duplication.
Let’s say there are multiple WordPress plugins which require a certain package (for example the Stripe SDK)… I effectively have duplicated copies of the Stripe SDK, since it will live in each plugin’s vendor folder.
I guess, that’s the only way to go about it, for plugins published in the directory.
But I wonder how this affects the site performance and if there is anything I can do for my own plugins that I don’t host on the WP directory (and hence I know I have to deal with dependencies myself).
Note that I am not talking about this: Multiple versions using composer
I am specifically talking about the described scenario within the WordPress environment, and if there is anything I could do to avoid having duplicates, like for example create a third plugin whose only job is to load the Stripe SDK, would that make sense?