0

I'm making various servers with Laravel, and a handful of times I've used a library that allows me, optionally, to pass in a $client variable - I tend to use Guzzle, as is standard I believe in Laravel, and sometimes I'll put some middleware into my guzzle client so I can see what kinds of requests the library is making.

But these libraries don't seem particularly coupled to Guzzle - Guzzle just apparently satisfies a particular 'interface', providing various methods and behaviours that any given library would expect an HTTP Client to have.

So if I wanted to write a library that allowed me to accept any HTTP Client with a Guzzle-like interface... what would that interface be? Is that clearly defined somewhere, and composer package makers always refer to that clear definition?

TKoL
  • 13,158
  • 3
  • 39
  • 73

0 Answers0