Skip to content

Version 2.0.0

Compare
Choose a tag to compare
@veewee veewee released this 29 Sep 11:19
· 25 commits to v2.x since this release
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

  • Open up this package for fibers by @veewee in #31

Full Changelog: 1.4.1...2.0.0