phpcent icon indicating copy to clipboard operation
phpcent copied to clipboard

Add support for http-client

Open tarjei opened this issue 3 years ago • 2 comments

Hi, thanks for this package!

I would be great if you could add support for using psr/http-client instead of hardcoded curl calls for duing the http calls as that would make it a lot easier to write tests of code that depends on this phpcent.

Either that or at least making the request and send methods protected so that it is possible to extend them and provide our own implementation of the http handling.

Regards, Tarjei

tarjei avatar Oct 19 '22 06:10 tarjei

Hello, feel free to open PR which allows extending methods and please provide an example how it's then possible to override those methods for testing. I am personally not using PHP on day to day basis – so prefer someone more experienced to do this.

FZambia avatar Apr 16 '23 15:04 FZambia

@tarjei To write tests, you rather need an interface that describes a contract for the client, which you can implement for your FackeClient.

It's a pity that the CentrifugoInterface is not included in the delivery, I had to implement my own wrapper.

use phpcent\Client;
class Centrifugo extends Client implements CentrifugoInterface {}

lav45 avatar Jan 04 '25 20:01 lav45