platformsh-client-php icon indicating copy to clipboard operation
platformsh-client-php copied to clipboard

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

Open mikemilano opened this issue 6 years ago • 4 comments

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 avatar Jun 04 '18 16:06 mikemilano

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"

mikemilano avatar Jun 04 '18 16:06 mikemilano

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...

pjcdawkins avatar Jun 04 '18 21:06 pjcdawkins

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.

mikemilano avatar Jun 04 '18 23:06 mikemilano

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.

Kingdutch avatar Feb 08 '22 09:02 Kingdutch