php-sdk
php-sdk copied to clipboard
Ability to add custom HTTP clients
I need to be able to log HTTP Requests & the corresponding response. This is currently not possible. Only the response is available to callers. The request is hidden.
The approach I wanted to implement:
- Extend the CurlHttpClient and override the
send()method, basically just wrapping it. Recording theHttpRequestargument and the response ofparent::send() - Extend the HttpClientFactory and add my own client in the constructor
- Call
ApiClient::setHttpClientType('my-custom-client')
This is currently not possible. Since both CurlHttpClient & HttpClientFactory are final classes.
I either have to copy-paste the whole library to my own codebase. Or create a patch that applies my changes using something like https://github.com/cweagans/composer-patches.
Both are not great.