sveneld opened a new pull request, #3492:
URL: https://github.com/apache/thrift/pull/3492

   ## Summary
   
   Adds new `Thrift\Transport\TPsrHttpClient` — an HTTP transport backed by any 
[PSR-18](https://www.php-fig.org/psr/psr-18/) 
`Psr\Http\Client\ClientInterface`. Concrete HTTP clients (Guzzle, Symfony 
HttpClient, php-http/curl-client) ship as Composer `suggest` so the library 
remains backend-agnostic; users plug in whichever client fits their stack. 
PSR-7 / PSR-17 factories are auto-discovered via `php-http/discovery` when not 
explicitly injected.
   
   `Thrift\Transport\TCurlClient` (procedural `ext-curl`) is marked 
`@deprecated` in favor of the new class and will be removed in the next 
version. `Thrift\Transport\THttpClient` (stream wrappers via `fopen`) remains 
as a dependency-free alternative and is untouched.
   
   ### Why
   
   - Pluggable backend, so users inherit connection pooling / HTTP/2 
multiplexing / DNS caching from a real client (Guzzle, Symfony) instead of the 
hand-rolled static curl handle.
   - Trivial to mock — tests inject a fake `ClientInterface` (no `phpmock` 
required).
   - Aligns with the PSR-3 logger work landed via THRIFT-6009.
   
   ### Files
   
   - `lib/php/lib/Transport/TPsrHttpClient.php` *(new)* — PSR-18 transport with 
auto-discovery fallback.
   - `lib/php/test/Unit/Lib/Transport/TPsrHttpClientTest.php` *(new)* — 15 unit 
tests using an injected fake `ClientInterface` and `nyholm/psr7`.
   - `lib/php/UPGRADING.md` *(new)* — migration guide with Guzzle examples and 
timeout / pooling caveats.
   - `lib/php/lib/Transport/TCurlClient.php` — `@deprecated` docblock only; no 
behavioral change.
   - `composer.json` — adds `psr/http-client`, `psr/http-factory`, 
`psr/http-message`, `php-http/discovery` to `require`; `nyholm/psr7` to 
`require-dev`; top-level `suggest` block for Guzzle / Symfony / curl-client; 
`config.allow-plugins` entry for `php-http/discovery`.
   
   ## Test plan (to verify before merge)
   
   - [ ] `composer update` (PHP 8.1+, Docker)
   - [ ] `vendor/bin/phpunit -c lib/php/phpunit.xml --testsuite Unit` — 15 new 
`TPsrHttpClientTest` cases plus existing suites
   - [ ] `composer phpstan` (level 6) clean
   - [ ] `make style` clean
   - [ ] Smoke test: instantiate `TPsrHttpClient` with `GuzzleHttp\Client` 
against an HTTP Thrift server
   
   ---
   
   - [x] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket? — 
[THRIFT-6010](https://issues.apache.org/jira/browse/THRIFT-6010)
   - [x] If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"? — yes
   - [x] Did you squash your changes to a single commit? — single commit
   - [x] Did you do your best to avoid breaking changes? — `TCurlClient` only 
gains `@deprecated`; `THttpClient` untouched; new class is purely additive
   - [ ] If your change does not involve any code, include `[skip ci]` — n/a 
(code change)
   
   Generated-by: Claude Opus 4.7 <[email protected]>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to