anlutro / php-curl

Simple PHP curl wrapper class

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support of ETag for API calls

hebabil opened this issue · comments

It would be interesting to support ETag for API calls (GET calls on resources).

The plugin would store the URI, the ETag and the response in a local cache (either a table, or file, or even use Laravel caching system). It would return the cached content if the ETag in the response header is the same than the one sent in the request.

What do you think about that ?

I think that's beyond the scope of this library, which is to just be a simple wrapper for the curl_ functions in PHP.

OK, seems to me that there are already some specific headers like authentification via CURLOPT_USERPWD. Thought that it would be interesting to add the If none match header as well as a unified mechanism for cache. No problem at all, I will implement something on top of the curl lib.

Thanks anyway for the lib ;-)

True, though those methods are just shortcuts for 2-3 other method calls. Adding ETag support would require some logic + integration with said cache layer, which could end up somewhat complex.

Yeah I totally understand your point of view. Thanks again for the quick reply 👍