php-http/httplug
HTTPlug provides HTTP client abstraction interfaces for PHP, built on PSR-7 messages. Defines async HttpAsyncClient plus a sync HttpClient similar to PSR-18, enabling libraries to stay client-agnostic while supporting multiple HTTP implementations.
psr/http-message v2 in addition to v1Http\Client\HttpClient, use PSR-18 instead$onRejected callback of HttpRejectedPromise to return a promise for implementing a retry
mechanism #168Http\Client\Exception\NetworkException no longer extends Http\Client\Exception\RequestException, in accordance with PSR-18After two years of work the FIG finally accepted our proposal for HTTP Client standard as PSR-18. This is a huge step in the life of HTTPlug.
Many thanks to @Nyholm who spearheaded the effort from the very first moment and worked extremely hard to pull this off. Thanks to the working group and everyone else, who made this possible.
During the development of plugins we faced a problem with exceptions thrown in plugins.
Any exceptions not implementing Http\Client\Exception ended up in an invalid argument error because of these lines:
https://github.com/php-http/promise/blob/v1.0.0/src/RejectedPromise.php#L36-L38
This type leak allowed to inject an exception to be passed to the onRejected callback of a Promise.
In the current release we introduced HTTP specific promises which does not catch all exceptions, but HTTP ones. Every other exception will be thrown immediately.
This release brings a cleaner exception concept which is documented directly in the interfaces.
There is also an initial support for discovering HTTP Clients using Puli.
Thanks to @joelwurtz we now have an asynchronous client and a promise in the contract.
Our plugin architecture will use this functionality.
Yay, finally we got here.
After 7 months of work, we are proud to present our HTTP Client contract to the world.
Although this started as a project providing adapters to already existing HTTP Clients, the goal changed to a more general approach.
This is the first preview release of the Http Adapter contract
How can I help you explore Laravel packages today?