Version 2.0.0
Upgrading
This new version removes the async implementation around amp v2 and httplug promises.
The new suggested way of performing async calls is by using a fiber based PSR-18 HTTP client.
Upgrading async transports
Your async transports and handlers can be transformed to regular sync
implementations.
You will need to provide a fiber based PSR-18 client as documented.
This client can then be used to run HTTP calls in parallel, using either reactphp or amphp v3.
$client = new AsyncPsr18Browser(new Browser());
$transport = JsonPreset::create($client, new TemplatedUriBuilder());
$handler = new FetchSomething($transport);
$run = fn($id) => async(fn () => $handler(new FetchRequest($id)));
$things = await(parallel([
$run(1),
$run(2),
$run(3),
]));
Upgrading sync transports
Previously, all presets had both a sync()
and async()
named constructor.
Since this package now doesn't distinguish this anymore, there is only one create()
named constructor.
You'll need to replace all occurences.
For example:
- JsonTransport::sync(...);
+ JsonTransport::create(...);
- JsonTransport::async(...);
+ JsonTransport::create(...);
- RawTransport::async(...);
+ RawTransport::create(...);
- RawTransport::async(...);
+ RawTransport::create(...);
What's Changed
Full Changelog: 1.4.1...2.0.0