We have to use GuzzleHttp in a module within a project that is already using this package.
GuzzleHttp/Exception/RequestException tries loading GuzzleHttp\Psr7\get_message_body_summary(), it doesn't load the function because throws that error:
'Whoops\Exception\ErrorException' with message 'Call to undefined function GuzzleHttp\Psr7\get_message_body_summary()' in ...
The functions are not loaded because that:
// Don't redefine the functions if included multiple times.
if (!function_exists('GuzzleHttp\Psr7\str')) {
require __DIR__ . '/functions.php'; // <<< get_message_body_summary() is here
}
It seens get_message_body_summary() does not exist in the main project's GuzzleHttp.
I don't know what to do to solve the problem...
Updated:
I've created a "vendor-static" directory with the incompatible package inside. It's loaded by composer with:
"autoload": {
"psr-4": {
"Cyberneticos\\Foundation\\Gateway\\": "src",
"Test\\":"tests/common",
"GuzzleHttp6\\": "vendor-static/guzzlehttp/guzzle/src/",
"GuzzleHttp6\\Psr7\\": "vendor-static/guzzlehttp/psr7/src/",
"GuzzleHttp6\\Promise\\": "vendor-static/guzzlehttp/promises/src/"
},
"files": [
"vendor-static/guzzlehttp/guzzle/src/functions_include.php",
"vendor-static/guzzlehttp/psr7/src/functions_include.php",
"vendor-static/guzzlehttp/promises/src/functions_include.php"
]
},
I use now the new GuzzleHttp6 in my project, with no errors.
I found this solution on: How does composer handle multiple versions of the same package?