My add-on requires google/apiclient package. And guzzlehttp/guzzle is one of its dependencies. However, it conflicts with the Xenforo package. Google API client requires a different version of guzzlehttp/guzzle from XenForo's installed version, and this causes failure during the link proxy.
I would strongly recommend against arbitrarily replacing any core package unless you have thoroughly tested all functionality (including addons) to ensure compatibility.
In any case, I don't think using the "replace" keyword will achieve what you want here - since we have no control over the core composer dependency versions and the autoloader will load those first, regardless of which versions we try to load in our addons. (This behaviour can be changed, but I strongly recommend against doing so).
So the core will load it's required version of Guzzle (6.3.x I believe is the current version) and then your addon will only have that version available - regardless of what version is included in your addon.
In this particular case, you don't need to replace Guzzle anyway, the
google/apiclient package is compatible with Guzzle 6.x:
"guzzlehttp/guzzle": "~5.3.1||~6.0||~7.0"
So if you just require the specific Guzzle version used by XenForo, it will sort itself out:
JSON:
{
"require": {
"google/apiclient": "^2.8",
"guzzlehttp/guzzle": "^6.3",
"guzzlehttp/psr7": "^1.6"
}
}
Note that you don't even have to do this - since the core provides its own Guzzle client which is compatible, so there's no need to package up the additional Guzzle dependencies in your addon.
I would simply use the following:
JSON:
{
"require": {
"google/apiclient": "^2.8"
},
"require-dev": {
"guzzlehttp/guzzle": "^6.0",
"guzzlehttp/psr7": "^1.6"
}
}
... this way you get to validate that the dependencies are compatible when you run composer update on your dev machine. You can also add whatever other core package versions you want to validate into the require-dev section so that your addon dependencies are resolved on your dev machine without being loaded into the built package.
Then just ensure that your build.json uses the
--no-dev composer flag to remove all dev dependencies at build time (as per the tutorial instructions).
I don't know that I would get too concerned about the PSR packages - you could spend hours tracking the dependencies and sub-dependencies for all packages in use, but these PSR packages don't change very frequently (by design - they are "standards" based and so are intended for maximum compatibility).