Skip to content

[php][php-nextgen] Support Guzzle 8 alongside Guzzle 7 - #25468

Open
JulianVennen wants to merge 2 commits into
OpenAPITools:masterfrom
JulianVennen:php-nextgen-guzzle-8
Open

JulianVennen wants to merge 2 commits into
OpenAPITools:masterfrom
JulianVennen:php-nextgen-guzzle-8

Conversation

@JulianVennen

@JulianVennen JulianVennen commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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-client and 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-Length header per part, which psr7 3.x no longer emits.

Written for commit 61dbc2a. Summary will update on new commits.

View guided diff

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 34 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

View guided diff | Re-trigger cubic

guzzlehttp/psr7 3.x, which Guzzle 8 requires, no longer adds a
Content-Length header to each multipart/form-data part. Make the header
optional in assertBodyContents() so the test passes with psr7 2 and 3.
@JulianVennen

Copy link
Copy Markdown
Contributor Author

General question: What's the intended way to plan changes for openapi-generator 8.0? The 8.0.x branch seems really outdated, should I make a PR against that which removes guzzle 7 completely?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant