Replies: 10 comments 3 replies
|
I would vote to go for a very simple interface like the one Stripe uses. https://github.com/stripe/stripe-php/tree/master/lib/HttpClient They use a very simple interface so the user can implement their own and ship with a cURL client by default. The cURL extension is by and large a default and available almost always and has no composer dependencies. If we would go that route it's trivial to implement a Guzzle or whatever implementation that can be given to the SDK to do it's HTTP work without needing the full plumbing Htttplug provides which we workaround quite a lot already for timeouts and proxy configurations for example. Frameworks like Laravel and Symfony could also by default replace the client with the default shipped by their framework with a simple client implementation. |
|
I would love to see |
|
What is Symfony's statement on how long they will support v5.0 of their HTTP client library? |
|
Symfony has its how LTS schedule, so that's not a problem: https://symfony.com/releases#symfony-releases-calendar IMHO we should still rely on PSR-18 as a decoupling interface to allow everyone to either use the provided client or swap-it-out with another custom one. This should give us the best of both worlds, because we can rely on any common HTTP client in PHP (even the Symfony one) to implement that one. |
|
Using/building something PRS 18 compatible is definitely a good idea. @stayallive Is the Laravel HTTP client PSR 18 compatible? Maybe @richardm-stripe or @dcr-stripe are open about telling us about the reasoning behind Stripe opting into implementing their own HTTP client in their SDK 🙏 |
|
Another input on this discussion: |
|
@nicolas-grekas questions: how does it work on first install? The plugin would run during the post-install? Even if it has to be explicitly enabled now, with newer Composer versions? What happens if no compatible implementation is available? |
|
Here is a PR to move this concern to php-http/discovery: php-http/discovery#208 The plugin runs on post-update yes. Of course if it's disabled then ppl take the responsibility to install the missing implementations on their own. The plugin is compatible with both composer v1 and v2 and with PHP >= 7.1. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
We're currently using Httplug to allow people to use their HTTP client of choice with the SDK.
This creates confusion about why we offer two composer packages
sentry/sentryvssentry/sdk.I also have the feeling that this is rarely used and slightly over-optimized.
Solution Brainstorm
Two good examples of other SDKs/libraries shipping with an HTTP client are the AWS PHP SDK (they use Guzzle) and Stripe (they implemented their own client).
While I do not think that Guzzle is necessary in our case, what other HTTP clients we could look into using in our SDK?
All reactions