platformsh / platformsh-client-php

Platform.sh API client for PHP
https://platform.sh
MIT License
25 stars 27 forks source link

PSR-18 Support (formerly: PSR-7 Support) #25

Open mikemilano opened 6 years ago

mikemilano commented 6 years ago

I have a project that uses Guzzle6, which conflicts with the 5.3 dependency in this project. As a result, I cannot install via composer.

With PSR-7 support, I would be able to make this work. It's nice for testing as well. http://docs.php-http.org/en/latest/index.html

Here's a project I'm working that has PSR-7 clients implemented: http https://github.com/mikemilano/xrphp

mikemilano commented 6 years ago

For anyone else having this problem in the short term, the master branch supports guzzle 6.3. PSR-7 implementation would still be valuable, however the work-around right now is to use the dev-master version in composer.

"platformsh/client": "dev-master"
pjcdawkins commented 6 years ago

Hi, yes the master branch (and the 2.x.x "beta" releases) works with Guzzle 6, and by extension uses PSR-7. So either of these would be compatible with Guzzle 6, and effectively the same thing right now:

"platformsh/client": "dev-master"
"platformsh/client": "^2.0.0@beta"

It's only "beta" because there hasn't been demand/reason to go further. We could change that...

mikemilano commented 6 years ago

Thanks for the info.

To clarify, I wasn't just recommending using a PSR-7 Guzzle implementation (what's the point?), but rather a PSR-7 approach as documented in the PHP-HTTP/HTTPLUG docs I linked where generic PSR-7 clients and messages are used so the library can discover and use whatever adapter the project uses.... instead of locking the developer's app into using whatever version of Guzzle you are using here.

Right now, since guzzle 6.3 is required in composer.json, anyone who's project had a guzzle 5.x requirement would not be able to use this library.

You will notice in the XRPHP project I linked, there's no specific guzzle version required, except in the tests. This means someone can use any adapter they want with the library, which includes guzzle 5, guzzle 6, curl, socket, cakephp, zend, etc.

That said, I'm not stuck and it's just a recommendation. I think implementing it will avoid the situation in the future where users need to use the non-stable release, or they are unable to use it at all.

Kingdutch commented 2 years ago

Perhaps we can retitle this to move to PSR-18 (psr/http-client-implementation) instead? As that's supported by things like php-http/guzzle6-adapter and by Guzzle 7 natively? That PSR is the follow-up to what HTTPlug was doing.