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

Document Symfony HttpClient #349

Open
tacman opened this issue Mar 15, 2024 · 5 comments
Open

Document Symfony HttpClient #349

tacman opened this issue Mar 15, 2024 · 5 comments

Comments

@tacman
Copy link
Contributor

tacman commented Mar 15, 2024

Since the http client is decoupled, this should install with the Symfony HttpClient. If this is correct, can it be added to the docs?

composer require 'j0k3r/graby dev-master'  symfony/http-client nyholm/psr7:^1.0
@jtojnar
Copy link
Collaborator

jtojnar commented Mar 15, 2024

Looks like it does provide http-client-implementation:

https://github.com/symfony/http-client/blob/cb5f957b5583278194080da3ffaa086eb65c5b38/composer.json#L19C10-L21

And https://github.com/Nyholm/psr7 looks neat.

But we would need to test it to be sure.

@tacman
Copy link
Contributor Author

tacman commented Mar 15, 2024

The Symfony HttpClient is async by default, and implements HttpPlug Promises, perhaps it is a solution for #323 .

@jtojnar
Copy link
Collaborator

jtojnar commented Mar 16, 2024

We still need async support in Graby itself, which is what #323 attempts to do.

Unfortunately, the HttpPlug promises had limitations that blocked this. Not sure if anything changed.

@tacman
Copy link
Contributor Author

tacman commented Mar 16, 2024

I'm far from an expert on this, but I think HttpPlug can be dropped in favor of https://github.com/Nyholm/psr7, as HttpPlug was written before some of the PSR's. But it's like going down a rabbit hole to start reading about how to set up contracts and adapters.

Maybe in a new version.

@jtojnar
Copy link
Collaborator

jtojnar commented Mar 16, 2024

Nyholm/psr7 is just one implementation of PSR-7. PSR-7 defines interfaces for HTTP messages. We need to target PSR-7 itself to be able to use other implementations.

HttpPlug is still needed because it is the closest thing to PSR-18 for async HTTP clients. Some parts of HTTPlug were already superseded by PSR-7 and PSR-18 and HTTPlug switched to them in those places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants