Skip to content

[13.x] Support Guzzle 8 and persistent connections across php-fpm requests - #60321

Open
GrahamCampbell wants to merge 2 commits into
13.xfrom
guzzle-8
Open

[13.x] Support Guzzle 8 and persistent connections across php-fpm requests#60321
GrahamCampbell wants to merge 2 commits into
13.xfrom
guzzle-8

Conversation

@GrahamCampbell

@GrahamCampbell GrahamCampbell commented May 29, 2026

Copy link
Copy Markdown
Collaborator

This PR adds support for Guzzle 8, while maintaining Guzzle 7 support. Guzzle 8 comes with a significant new feature: PHP 8.5+ users with ext-curl installed can have connections shared across php-fpm requests. I've implemented this with the following DX:

// app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\PersistentTransport;

public function boot(): void
{
    Http::globalPersistentTransport(PersistentTransport::Preferred);
}

The PersistentTransport surfaces 3 options:

  • None: Do not try and share connections. This is the current behaviour, and remains the default.
  • Preferred: Try to share connections, but if we are not able to, silently fallback.
  • Required: Try to share connections, and if we are not able to, fail loud.

@GrahamCampbell
GrahamCampbell force-pushed the guzzle-8 branch 2 times, most recently from 2f8a29c to a0ee337 Compare July 12, 2026 11:29
@GrahamCampbell
GrahamCampbell force-pushed the guzzle-8 branch 2 times, most recently from 44a9b08 to e57fb66 Compare July 26, 2026 22:30
@GrahamCampbell
GrahamCampbell marked this pull request as ready for review July 26, 2026 22:37
*
* @param \Psr\Http\Message\StreamInterface|array|string|resource|null $body
* @param int $status
* @param array<string, mixed> $headers

@GrahamCampbell GrahamCampbell Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Header names might not be strings because PHP forces numeric strings to ints, to array aka array<array-key, mixed> really is the right type here!

@GrahamCampbell

Copy link
Copy Markdown
Collaborator Author

Rebased to get a clean CI run. Guzzle 7 gets exercised by the prefer lowest tests, and Guzzle 8 by the rest.

mokuzon added a commit to line/line-bot-sdk-php that referenced this pull request Jul 28, 2026
The main test matrix always resolves to Guzzle 7 because laravel/framework
(via orchestra/testbench) does not allow Guzzle 8 yet, so the widened
guzzle constraint was not exercised by CI at all. Add a job that drops the
Laravel-only dev dependency and runs the framework-agnostic test suites
(Parser and Test, which cover the generated API clients) against Guzzle 8.
This mirrors the only real-world Guzzle 8 setup: non-Laravel applications,
since Laravel apps cannot install Guzzle 8 in the first place.

Declare mockery/mockery explicitly in require-dev; the client tests use it
directly but previously received it transitively from orchestra/testbench,
which this job removes.

This job can be deleted once laravel/framework allows guzzle ^8.0
(laravel/framework#60321) and the main matrix picks up Guzzle 8 natively.
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