Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Symfony PSR-18 HTTP client #1576

Closed
wants to merge 3 commits into from
Closed

Support Symfony PSR-18 HTTP client #1576

wants to merge 3 commits into from

Conversation

ste93cry
Copy link
Collaborator

To work around issue #1541, we could support the built-in Symfony PSR-18 HTTP client and make it the preferred one to use. Http\Client\Common\PluginClient ensures that a non-async client gets wrapped by EmulatedHttpAsyncClient and this allows us to not have to change anything in the rest of the codebase. There is no version of Symfony that doesn't have both the PSR-18 and Httplug client, so the possibilities of instantiating the SymfonyHttplugClient class should be none.

Since the HttpTransport is already syncronous, I don't expect any performance penalty with this change. However, the dependency on the php-http/message-factory package can now be removed safely.

@cleptric
Copy link
Member

cleptric commented Jul 31, 2023

Can you push the branch to this repo? This will make it easier for folks giving it a try.

@ste93cry
Copy link
Collaborator Author

Sure, here it is. I will keep it in sync with the one in my fork repo so that I don't have to open a new PR.

@@ -111,7 +112,7 @@ public function create(Options $options): HttpAsyncClientInterface
*/
private function resolveClient(Options $options)
{
if (class_exists(SymfonyHttplugClient::class)) {
if (class_exists(SymfonyPsr18Client::class) || class_exists(SymfonyHttplugClient::class)) {
Copy link
Member

@cleptric cleptric Aug 1, 2023

Choose a reason for hiding this comment

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

While this might be more of a hypothetical concern if, for any reason, we do end up with the SymfonyHttplugClient or if we fall through and php-http/discovery defaults to SymfonyHttplugClient, we run into the same issue we're trying to solve.

Again, our stance is that we can accept living with an abandoned package for a bit longer. Causing exceptions, even if they do not stem from the SDK, is not ok.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can easily remove everything related to the Httplug client, the PSR-18 client is more than enough as explained above. Do you feel safer this way?

Copy link
Member

Choose a reason for hiding this comment

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

Not for the php-http/discovery case. Let's keep it for the moment. Maybe we get some feedback in #1541

Copy link
Collaborator Author

@ste93cry ste93cry Aug 1, 2023

Choose a reason for hiding this comment

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

Not for the php-http/discovery case.

We can technically replace that case with the PSR-18 discovery. The only thing that would change is that we have to require psr/http-client-implementation instead of php-http/async-client-implementation. I may think about an unlikely case where you will not be able to update quietly to the new version because you are missing installed a PSR-18 compatible client, but as far as I see every single HTTP client supported by the autodiscovery that would be resolved now is also PSR-18 compatible, so there should be nothing to do: if it worked before, it should work after.

@ste93cry
Copy link
Collaborator Author

ste93cry commented Aug 10, 2023

@cleptric do you want to move forward with this? One week should be enough to gather feedback considering the activity of the original issue

@getsantry getsantry bot added the Stale label Oct 18, 2023
@getsentry getsentry deleted a comment from getsantry bot Oct 18, 2023
@cleptric cleptric removed the Stale label Oct 18, 2023
@cleptric
Copy link
Member

cleptric commented Nov 6, 2023

@ste93cry please update the PR and move the branch to this repo. I can run some tests this week.

@ste93cry ste93cry changed the base branch from master to 3.x November 6, 2023 18:08
@ste93cry
Copy link
Collaborator Author

ste93cry commented Nov 6, 2023

move the branch to this repo

I've already pushed the branch to this repo too. However I would prefer to keep working on my fork so that I don't need to close this PR, resulting in a loss of the context and conversations we had. In the end, the source branch should not matter much...

@ste93cry
Copy link
Collaborator Author

Closing this because it's evident that there is a lack of interest in merging this PR, especially now that the new SDK is out.

@ste93cry ste93cry closed this Dec 21, 2023
@ste93cry ste93cry deleted the support-symfony-psr18-http-client branch December 21, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants