[ 
https://issues.apache.org/jira/browse/THRIFT-6010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Volodymyr Panivko resolved THRIFT-6010.
---------------------------------------
    Resolution: Fixed

> Add PSR-18 HTTP transport (TPsrHttpClient) for PHP library
> ----------------------------------------------------------
>
>                 Key: THRIFT-6010
>                 URL: https://issues.apache.org/jira/browse/THRIFT-6010
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Library
>    Affects Versions: 0.24.0
>            Reporter: Volodymyr Panivko
>            Assignee: Volodymyr Panivko
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Add a new HTTP client transport for the PHP library: 
> {{Thrift\Transport\TPsrHttpClient}}. Purely additive — existing 
> {{TCurlClient}} and {{THttpClient}} are untouched.
> *Design*
> * Constructor: {{(string $url, ?ClientInterface $client = null, 
> ?RequestFactoryInterface $requestFactory = null, ?StreamFactoryInterface 
> $streamFactory = null)}}.
> * Delegates all network I/O to a PSR-18 {{ClientInterface}}; PSR-7 messages 
> and PSR-17 factories handle request/URL construction. URL parsing, 
> port-suppression and percent-encoding are no longer hand-rolled.
> * When client / factories are omitted, {{php-http/discovery}} resolves them. 
> Discovery failures are wrapped as {{TTransportException::NOT_OPEN}} with an 
> actionable "Install one of: guzzlehttp/guzzle, symfony/http-client, 
> php-http/curl-client" message instead of an autoloader-level fatal.
> * PSR-7 {{\InvalidArgumentException}} and {{\RuntimeException}} from 
> {{createStream}}/{{createRequest}}/{{withHeader}} are wrapped as 
> {{TTransportException::NOT_OPEN}}. PSR-18 {{NetworkExceptionInterface}} maps 
> to {{NOT_OPEN}}, other {{ClientExceptionInterface}} subtypes and non-200 
> responses map to {{UNKNOWN}}.
> *Composer*
> * {{require}}: {{psr/http-client}}, {{psr/http-factory}}, 
> {{psr/http-message}}, {{php-http/discovery}}.
> * {{suggest}}: {{guzzlehttp/guzzle}}, {{symfony/http-client}}, 
> {{php-http/curl-client}}.
> * {{require-dev}}: {{nyholm/psr7}} for the unit-test suite.
> * {{config.allow-plugins}}: {{php-http/discovery}} explicitly allow-listed 
> (Composer 2.2+ requirement).
> *Tests*
> New {{TPsrHttpClientTest}} (15 cases) uses an injected fake 
> {{ClientInterface}} and real {{nyholm/psr7}} factories — no {{phpmock}} 
> required. Covers headers, URL pass-through, exception mapping (network, 
> client, invalid URL), empty body, buffer lifecycle, status codes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to