adimihaila / promise-wait
Provides a wait functionality for ReactPHP/Promise library.
Installs: 2 624
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- react/promise: ^2.5
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-06-18 22:28:13 UTC
README
ReactPHP promise/wait
This lightweight library provides a wait functionality for ReactPHP/promise library.
Installation
composer require adimihaila/promise-wait
Usage
<?php
use React\Promise\Deferred;
function doAsyncSomething() {
$deferred = new Deferred();
$deferred->resolve($value);
return $deferred->promise();
}
$value = doAsyncSomething()
->then(function ($response) {
sleep(5);
return $response++;
});
echo \AdiMihaila\Promise\wait($value);