danielmarschall / oidplus

OIDplus 2.0 - An OpenSource online Registration Authority for OIDs and other Object Types
https://www.oidplus.com
Apache License 2.0
10 stars 6 forks source link

Use Guzzle instead of cURL? #9

Open danielmarschall opened 1 year ago

danielmarschall commented 1 year ago

https://docs.guzzlephp.org/en/stable/overview.html

Pro:

Contra

danielmarschall commented 1 year ago

In the current version, all calls to CURL have been put into the function url_post_contents() which acts the same ways as url_get_contents(). The method url_post_contents_available() helps finding out if POST can be used, i.e. CURL is installed.

If we'd use Guzzle, we just need to change url_post_contents() now

wehowski commented 10 months ago

Hello Daniel, just one idea: guzzle implements the PSR-18 Interfaces. Why not do the same with a PSR-18 OIDplus Guzzle/Curl Wrapper. Global functions like url_post_contents are ok too, but your Http-Client class maybe would be useable in other applications too if you use/implement (agnostic) interfaces.

If you implement PSR specs everywhere possible and reasonable, you can be quite sure that to change one successor should be easy.

Another thing you can try is to use PHP-Version switches in installing/composer. One approach to do so (but be carefull and test it its dirty!) is to just require "guzzlehttp/guzzle" : "*" instead of specifying a version composer automatically takes the best compatible one regarding minimum-stabillity and etc... ( But for guzzle the php 7.0 version then would be https://packagist.org/packages/guzzlehttp/guzzle#6.5.x-dev ? )

Viele Grüße Till