esroyo/react-promise-settle
Returns a promise that is fulfilled when all of the provided promises have been fulfilled or rejected.
Maintainers
Requires
- php: >=5.4.0
- react/promise: ^2.7.1
Requires (Dev)
- phpunit/phpunit: ^7.1 || ^6.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 7aa0bde71b16ad08c3696b377961ecc61e885a8e
- Carles Escrig i Royo <esroyo.woop@gmail.com>
This package is auto-updated.
Last update: 2026-06-27 04:45:34 UTC
README
👁 builds.sr.ht status
👁 Software License
👁 Total Downloads
Provides a settle() function missing from the official react/promise.
Installation
composer require esroyo/react-promise-settle
Usage
$promise = Esroyo\React\Promise\settle(array $promisesOrValues);
Returns a promise that is fullfilled when all the items in $promisesOrValues have been fulfilled or rejected.
The resolution value of the returned promise will be an state associative array containing a "state" key mapping to a valid promise state. If the state of the promise is "fulfilled", the array will contain a "value" key mapping to the fulfilled value of the promise. If the promise is rejected, the array will contain a "reason" key mapping to the rejection reason of the promise.
Example result (array keys should be according to $promisesOrValues input):
[
['state' => 'fulfilled', 'value' => 'Result of work'],
['state' => 'rejected', 'reason' => 'Timeout'],
...
]
Credits
This package is a reaccommodation of cubetools/react-settle-promise and the original idea, authored by @jsor and @SimonHeimberg.
