Releases: PhpGt/Fetch
New `awaitFetch` method
Refactor web APIs to phpgt/http
This release refactors the web API classes used in this repository into the upstream phpgt/http library.
What's Changed
- Bump phpunit/phpunit from 9.5.21 to 9.5.28 by @dependabot in #101
- maintenance: dependabot by @g105b in #98
- Promise simplify by @g105b in #144
- Improvements to CI by @g105b in #145
- Allow "redirect: error" option by @g105b in #147
- feature: post data with formdata by @g105b in #149
- FormData posts and uploads by @g105b in #151
New Contributors
- @dependabot made their first contribution in #101
Full Changelog: v1.1.0...v1.1.1
Replaced async functionality
This feature removes any third part implementations of the underlying Promise implementation.
What's Changed
- Upgrade to GitHub-native Dependabot by @dependabot-preview in #94
- funding by @g105b in #95
- build: hard dependencies by @g105b in #96
- Replace Async functionality by @g105b in #100
Full Changelog: v1.0.1...v1.1.0
JSON improvements
Type-safe functions have been added to the Json
object, along with enhanced iterator functions. This release is being made ready for the work starting on v2, where PhpGt's Async functions are integrated as opposed to React's.
Stable release
The last few weeks have seen many PHP.Gt repositories reach stable release, and as Fetch was dependent on a few core repositories, is has finally got a clear dependency tree of stable repositories through Composer.
Blob response type
The 0.7.x releases mark the final steps towards stable release, implementing the other types of response, starting with the blob
type.
Implementing the different types has outlined a potential new repository for PhpGt: WebAPI
, which would be a collection of the standard objects that make up the W3C WebAPI, such as Blob, ArrayBuffer, etc. For now, these exist within Fetch, because there doesn't seem to be much use of reusing them on the server elsewhere... yet.
CURLOPT from RequestInterface
Calling the fetch method with a PSR-7 RequestInterface is now possible, with the library converting the properties of the Request object to the corresponding CURLOPT settings.
Resolution of JSON
Along with some working example code in /example, the main feature added to this development release is the ability to resolve JSON responses, as with the client-side fetch API.
This means that if you are expecting a response to be a JSON document, returning $response->json()
will resolve a promise that will receive the pre-decoded JSON object for use.
Check out example/02-post-request.php
for example code showcasing this.
Send useragent by default
While using this library in real world tests, it seems that a lot of APIs (Github's for example) require a useragent header to be sent with a request.
It's possible to set your own headers, but this shouldn't be a required step, as just using curl
on the commandline or from PHP automatically sets their default useragent, so now this library does too.
Recursive promise fulfilment
The issue that was being tracked by #28 is now resolved. The response of a promise's fulfilment could also be a promise, which was in turn not being fulfilled.
Now a recursive check is made to ensure all promises are called in the current chain.