I have installed a custom theme and an SMTP plugin on my website and they both include Google API PHP Client for different purposes. Unfortunately, the dependency used by the plugin and theme are of different versions, and they could not be upgraded or downgraded easily.
This results in a conflict, where the plugin loads the package from the Theme instead of its own, and throws errors.
Here is the Composer for the theme.
{
"require": {
"google/apiclient": "^2.2.1"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"autoload": {
"psr-4": {
"BH\\": "includes/"
}
},
"extra": {
"google/apiclient-services": [
"Sheets"
]
}
}
And the theme makes use of the namespace BH
Is there a way to limit using Composer to load the Google API PHP Client files only for the code executed by the theme (with namespace BH) and not to the plugin that makes use of a different namespace (say ABC).
Please note: I have attempted scoping and it makes the entire situation even more complex.