This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Nice job! And FR: Swappable PSR-7-compliant HTTP client library #7
Labels
enhancement
New feature or request
I came here to say great work on putting this together. It looks good and it's really nicely organised. I've only been reading code and haven't had a chance to try it out yet, but I feel like this could become a great package to make integrating with lots of APIs easier!
One thing I picked up on pretty quickly though is how dependent it is on Guzzle (I love Guzzle btw, so it's fine for me). I know it's early days for this package and I'm sure (/hope) you have plans in mind to make this not such a hard dependency as it feels quite useful for such a fundamental (and PSR-compliant) library to be easily replaceable.
To that end though, one thing that I spotted that will kind of make this harder is that the request config (and possibly other structures) is exposed directly to Guzzle: your
SaloonRequest
class (or more correctly, theCollectsConfig
trait) gathers it all up and essentially passes it Guzzle unfiltered in yourRequestManager
.It feels like a good goal would be to abstract this away so that Guzzle could be swapped out as needed.
Eventually you'd end up with a standard set of config options that work across HTTP client libraries. Even if your internal structure matches Guzzle's for convenience (and it may stay that way for a long time), you could introduce a transform layer between your structure and the HTTP client being used so that devs can use a consistent interface across libraries.
You and users of this package would be less susceptible to changes on Guzzle's side, for example if they suddenly removed an option, you could help maintain backwards compatibility for folks.
You could then also remove Guzzle as a dependency, which means fewer potential conflicts for people too.
The text was updated successfully, but these errors were encountered: