Skip to content

Commit

Permalink
Use reactphp/async instead of clue/reactphp-block
Browse files Browse the repository at this point in the history
  • Loading branch information
dinooo13 committed Oct 1, 2022
1 parent 3909651 commit 11ab05e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 60 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,17 @@ If this looks strange to you, you can also use the more traditional [blocking AP
As stated above, this library provides you a powerful, async API by default.

If, however, you want to integrate this into your traditional, blocking environment,
you should look into also using [clue/reactphp-block](https://github.com/clue/reactphp-block).
you should look into also using [reactphp/async](https://github.com/reactphp/async).

The resulting blocking code could look something like this:

```php
use Clue\React\Block;

$client = new Clue\React\Docker\Client();

$promise = $client->imageInspect('busybox');

try {
$results = Block\await($promise, Loop::get());
$results = \React\Async\await($promise);
// resporesults successfully received
} catch (Exception $e) {
// an error occured while performing the request
Expand All @@ -182,10 +180,10 @@ $promises = array(
$client->imageInspect('ubuntu'),
);

$inspections = Block\awaitAll($promises, Loop::get());
$inspections = \React\Async\await(\React\Async\parallel($promises));
```

Please refer to [clue/reactphp-block](https://github.com/clue/reactphp-block#readme) for more details.
Please refer to [reactphp/async](https://github.com/reactphp/async#readme) for more details.

#### Command streaming

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"rize/uri-template": "^0.3"
},
"require-dev": {
"clue/block-react": "^1.5",
"react/async": "^4 || ^3 || ^2",
"clue/caret-notation": "^0.2",
"clue/tar-react": "^0.2",
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
Expand Down
Loading

0 comments on commit 11ab05e

Please sign in to comment.