[php][php-nextgen] Support Guzzle 8 alongside Guzzle 7
Widen the composer constraints of the php and php-nextgen clients to allow guzzlehttp/guzzle ^8.0 and guzzlehttp/psr7 ^3.0 in addition to the existing versions, and require psr/http-client explicitly.
Guzzle 8 only exposes getResponse() on ResponseException, so the generated API classes now read the response through a helper that works on both versions. Network failures are caught via the PSR-18 NetworkExceptionInterface, which also covers Guzzle 8's new timeout exceptions, and the async error handler no longer fails with an Error when the exception carries no response.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
@jebentier @dkarlovi @mandrean @jfastnacht @ybelenko @renepardon
Summary by cubic
Adds Guzzle 8 and PSR-7 3 support to generated PHP clients while retaining compatibility with Guzzle 7. Network failures, including Guzzle 8 timeout exceptions, are handled through PSR-18, and response errors work across both Guzzle versions.
- Generated clients now require
psr/http-clientand accept the expanded Composer version constraints. - Async error handling no longer crashes when an exception has no response.
- The petstore multipart test no longer requires a
Content-Lengthheader per part, which psr7 3.x no longer emits.