Follow up on discussions that took place in https://github.com/swagger-api/swagger-codegen/pull/5190 and https://github.com/swagger-api/swagger-codegen/issues/1482. In some cases dependency on guzzle may be a problem and it should be possible to use any other psr7-compatible client. Its should not be a big deal considering that generated client is already using psr7 compatible request and response objects.
2.3.0+
n/a
--library=none or something
n/a
https://github.com/swagger-api/swagger-codegen/pull/5190
https://github.com/swagger-api/swagger-codegen/issues/1482
n/a
The best would be to use php-http directly as it provide HTTP client abstraction with PSR7 interfaces compliance and allows end user to choose which one to use: http://docs.php-http.org/en/latest/clients.html
It simple and used by a lot of PHP libraries now: https://packagist.org/packages/php-http/httplug/dependents
I see it was proposed in https://github.com/swagger-api/swagger-codegen/pull/5190/files#r108366631 but removed, why?
unless you need async requests, i would not depend on the httplug client interface but the psr-18 interface directly, and psr-17 for the factory for requests.
php-http offers a bunch of clients implementing the client interface, and the next guzzle version is expected to implement psr-18 directly. the way to go would be to require a psr/http-client-implementation and then let the user configure the library with a client or potentially use php-http/discovery to automatically discover an available client.
Would this be something to implement as an option, or just as another type of generated output? If I wanted to pay with this approach, is there any way to wrap the output as a plugable module? I can imagine there are many dozens of generated code that people may want to produce (for example, I would like to generate just the message generation without any client) so there is surely a way that can be done without forking and modifying the whole application?
Most helpful comment
unless you need async requests, i would not depend on the httplug client interface but the psr-18 interface directly, and psr-17 for the factory for requests.
php-http offers a bunch of clients implementing the client interface, and the next guzzle version is expected to implement psr-18 directly. the way to go would be to require a psr/http-client-implementation and then let the user configure the library with a client or potentially use php-http/discovery to automatically discover an available client.