eugenezadorin / airtable-php

Simple PHP client for Airtable API
20 stars 7 forks source link

Set $this->handler in Request within the construct #7

Closed logistiker closed 1 year ago

logistiker commented 1 year ago

It would be helpful if you set $this->handler to initialize curl within the construct instead of within the send method so that the entire send method does not have to be replaced just to use different curl options.

eugenezadorin commented 1 year ago

Hi! Thanks for your feedback.

Can you please provide more information about the issue you want to solve?

As I can see, $this->handler actually can just be replaced with local variable, there is no need to keep it as class property at all.

CURL options are related to Airtable API server, is there any reason to change/override them from outside? If so, I probably can extract CURL configuration to small protected method, which can be easily overridden.

logistiker commented 1 year ago

The request class doesn't have to be used for airtable only. You can use it for other things since it's not airtable specific. So if you want to use it for something other than airtable and on a server with a self-signed certificate, you have to override the whole function to change the curl configuration which negates the entire method.

eugenezadorin commented 1 year ago

No, actually Request class is airtable-specific and should be used only inside this library.

If you need general purpose class, it will probably better to use something like guzzle