Skip to content

Decouple from symfony/http-client #756

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

Closed
ostrolucky opened this issue Aug 29, 2020 · 7 comments
Closed

Decouple from symfony/http-client #756

ostrolucky opened this issue Aug 29, 2020 · 7 comments

Comments

@ostrolucky
Copy link

I don't want to be forced to instal symfony/http-client. Can't this package be decoupled from it and use only contracts, or extracted to package which is decoupled?

@jderusse
Copy link
Member

I agree with decoupling, we only need a symfony/http-client-contracts or a symfony/http-client-implementation.

But I personally don't like libraries that only require a contract (or a "provider" virtual package) and ask you to add an implementation.
It's frustrating and source of confusion for end users.

I would like beeing able to tell composer "I want a package that provide this implementation, if none are installed, use this one". But it's not possible at the moment composer/composer#6758 that's why I'm 👎 for this.

@ostrolucky
Copy link
Author

Then you can go with second approach I suggested. Have a tiny wrapper package that comes with symfony/http-client and requires async-aws/core which requires contracts only.

@jderusse
Copy link
Member

given async-aws provides 1 package per service and they all required async-aws/core, we'll have to do the same for the current 25 packages.
That too much work for maintaining.

Out of curiosity, what alternative implements the symfony/http-client-contracts?

@ostrolucky
Copy link
Author

ostrolucky commented Aug 30, 2020

I don't know what alternative implements it, I just wanted to write adapter for some PSR client and use that.

Maybe some another idea that could work is to have package double that is marked it "provides" async-aws/core. That way, people could require this package which doesn't have this dependency first, then concrete aws-async service package - this will result in not having to install real async-aws/core package and hence neither symfony/http-client.

@Nyholm
Copy link
Member

Nyholm commented Sep 18, 2020

I've played with the idea a few times. But I find that

  1. It is really difficult to implement the symfony/http-client-contracts.
  2. It makes things unnecessary complicated for the user if we dont require symfony/http-client

For example, how do we create a new HttpClient object if none is passed to us? Either we say "You need to install symfony/http-client", but since that is the only public implementation, why not require it and use it?

With that said, There is nothing stopping you from passing your custom HttpClientInterface to use with AsyncAws, the downside is that you need to install symfony/http-client without using it.

Or is there something blocking you from using a custom HTTP client?

@ostrolucky
Copy link
Author

ostrolucky commented Sep 18, 2020

Honestly, I don't know. I just never liked that official aws libraries require guzzle, but on the other hand your packages require Symfony httpclient, so that's not different. I thought ecosystem is past doing this kind of thing for new packages. So no, this is not the problem right now, but history taught us this will become a problem. Symfony http client will break the BC at some point. At this point, users will be blocked from installing this package if they still use libraries requiring different http client API.

@ostrolucky
Copy link
Author

Let's close for now then, it will make more sense to open this with more available implementations

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

No branches or pull requests

3 participants