react/promise
A lightweight implementation of CommonJS Promises/A for PHP
v3.3.0
405M downloads/mo
#132 most downloaded on composer
reactphp/promise
What this package is like to depend on
Last release 1 years ago
19 Aug 2025
Ships fairly regularly
a new release about every 8 months
Some releases are documented
notes for 12 of 30 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
30 releases · first in 2012
0 releases in the last 12 months
see the full history below
Release timeline
30 releases · Nov 2012 to Aug 2025Releases
latest 30-
v3.3.019 Aug 2025Release notes
Open source →-
Feature: Improve PHP 8.5+ support by avoiding deprecated switch case syntax.
(#264 by @theodorejb) -
Feature: Run tests on PHP 8.4 and update test environment.
(#271 by @clue)
-
-
v3.2.024 May 2024Release notes
Open source →-
Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations. (#260 by @Ayesh)
-
Feature: Include previous exceptions when reporting unhandled promise rejections. (#262 by @clue)
-
Update test suite to improve PHP 8.4+ support. (#261 by @SimonFrings)
-
-
v3.1.016 Nov 2023Release notes
Open source →-
Feature: Full PHP 8.3 compatibility. (#255 by @clue)
-
Feature: Describe all callable arguments with types for
PromiseandDeferred. (#253 by @clue) -
Update test suite and minor documentation improvements. (#251 by @ondrejmirtes and #250 by @SQKo)
-
-
v3.0.011 Jul 2023Release notes
Open source →A major new feature release, see release announcement.
-
We'd like to emphasize that this component is production ready and battle-tested.
We plan to support all long-term support (LTS) releases for at least 24 months,
so you have a rock-solid foundation to build on top of. -
The v3 release will be the way forward for this package. However, we will still
actively support v2 and v1 to provide a smooth upgrade path for those not yet
on the latest versions.
This update involves some major new features and a minor BC break over the
v2.0.0release. We've tried hard to avoid BC breaks where possible and
minimize impact otherwise. We expect that most consumers of this package will be
affected by BC breaks, but updating should take no longer than a few minutes.
See below for more details:-
BC break: PHP 8.1+ recommended, PHP 7.1+ required.
(#138 and #149 by @WyriHaximus) -
Feature / BC break: The
PromiseInterfacenow includes the functionality of the oldandExtendedPromiseInterface.CancellablePromiseInterface
Each promise now always includes thethen(),catch(),finally()andcancel()methods.
The newcatch()andfinally()methods replace the deprecatedandotherwise()methods which continue to exist for BC reasons.always()
The oldandExtendedPromiseInterfaceare no longer needed and have been removed as a consequence.CancellablePromiseInterface
(#75 by @jsor and #208 by @clue and @WyriHaximus)// old (multiple interfaces may or may not be implemented) assert($promise instanceof PromiseInterface); assert(method_exists($promise, 'then')); if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'otherwise')); } if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'always')); } if ($promise instanceof CancellablePromiseInterface) { assert(method_exists($promise, 'cancel')); } // new (single PromiseInterface with all methods) assert($promise instanceof PromiseInterface); assert(method_exists($promise, 'then')); assert(method_exists($promise, 'catch')); assert(method_exists($promise, 'finally')); assert(method_exists($promise, 'cancel'));
-
Feature / BC break: Improve type safety of promises. Require
mixedfulfillment value argument andThrowable(orException) as rejection reason.
Add PHPStan template types to ensure strict types forresolve(T $value): PromiseInterface<T>andreject(Throwable $reason): PromiseInterface<never>.
It is no longer possible to resolve a promise without a value (usenullinstead) or reject a promise without a reason (useThrowableinstead).
(#93, #141 and #142 by @jsor, #138, #149 and #247 by @WyriHaximus and #213 and #246 by @clue)// old (arguments used to be optional) $promise = resolve(); $promise = reject(); // new (already supported before) $promise = resolve(null); $promise = reject(new RuntimeException());
-
Feature / BC break: Report all unhandled rejections by default and remove
method.done()
Add newset_rejection_handler()function to set the global rejection handler for unhandled promise rejections.
(#248, #249 and #224 by @clue)// Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 reject(new RuntimeException('Unhandled'));
-
BC break: Remove all deprecated APIs and reduce API surface.
Remove,some(),map()functions, usereduce()any()andall()functions instead.
Remove internalandFulfilledPromiseclasses, useRejectedPromiseresolve()andreject()functions instead.
Remove legacy promise progress API (deprecated third argument tothen()method) and deprecatedclass.LazyPromise
(#32 and #98 by @jsor and #164, #219 and #220 by @clue) -
BC break: Make all classes final to encourage composition over inheritance.
(#80 by @jsor) -
Feature / BC break: Require
array(oriterable) type forall()+race()+any()functions and bring in line with ES6 specification.
These functions now require a single argument with a variable number of promises or values as input.
(#225 by @clue and #35 by @jsor) -
Fix / BC break: Fix
race()to return a forever pending promise when called with an emptyarray(oriterable) and bring in line with ES6 specification.
(#83 by @jsor and #225 by @clue) -
Minor performance improvements by initializing
Deferredin the constructor and avoidingcall_user_func()calls.
(#151 by @WyriHaximus and #171 by @Kubo2) -
Minor documentation improvements.
(#110 by @seregazhuk, #132 by @CharlotteDunois, #145 by @danielecr, #178 by @WyriHaximus, #189 by @SrDante, #212 by @clue, #214, #239 and #243 by @SimonFrings and #231 by @nhedger)
The following changes had to be ported to this release due to our branching
strategy, but also appeared in the2.xbranch:-
Feature: Support union types and address deprecation of
ReflectionType::getClass()(PHP 8+).
(#197 by @cdosoftei and @SimonFrings) -
Feature: Support intersection types (PHP 8.1+).
(#209 by @bzikarsky) -
Feature: Port all memory improvements from
2.xto3.x.
(#150 by @clue and @WyriHaximus) -
Fix: Fix checking whether cancellable promise is an object and avoid possible warning.
(#161 by @smscr) -
Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
(#134 by @WyriHaximus) -
Improve test suite, update PHPUnit and PHP versions and add
.gitattributesto exclude dev files from exports.
(#107 by @carusogabriel, #148 and #234 by @WyriHaximus, #153 by @reedy, #162, #230 and #240 by @clue, #173, #177, #185 and #199 by @SimonFrings, #193 by @woodongwong and #210 by @bzikarsky)
The following changes were originally planned for this release but later reverted
and are not part of the final release:-
Add iterative callback queue handler to avoid recursion (later removed to improve Fiber support).
(#28, #82 and #86 by @jsor, #158 by @WyriHaximus and #229 and #238 by @clue) -
Trigger an
E_USER_ERRORinstead of throwing an exception fromdone()(later removed entiredone()method to globally report unhandled rejections).
(#97 by @jsor and #224 and #248 by @clue) -
Add type declarations for
some()(later removed entiresome()function).
(#172 by @WyriHaximus and #219 by @clue)
Release notes
Open source →A major new feature release, see release announcement.
-
We'd like to emphasize that this component is production ready and battle-tested. We plan to support all long-term support (LTS) releases for at least 24 months, so you have a rock-solid foundation to build on top of.
-
The v3 release will be the way forward for this package. However, we will still actively support v2 and v1 to provide a smooth upgrade path for those not yet on the latest versions.
This update involves some major new features and a minor BC break over the
v2.0.0release. We've tried hard to avoid BC breaks where possible and minimize impact otherwise. We expect that most consumers of this package will be affected by BC breaks, but updating should take no longer than a few minutes. See below for more details:-
BC break: PHP 8.1+ recommended, PHP 7.1+ required. (#138 and #149 by @WyriHaximus)
-
Feature / BC break: The
PromiseInterfacenow includes the functionality of the oldandExtendedPromiseInterface. Each promise now always includes theCancellablePromiseInterfacethen(),catch(),finally()andcancel()methods. The newcatch()andfinally()methods replace the deprecatedandotherwise()methods which continue to exist for BC reasons. The oldalways()andExtendedPromiseInterfaceare no longer needed and have been removed as a consequence. (#75 by @jsor and #208 by @clue and @WyriHaximus)CancellablePromiseInterface// old (multiple interfaces may or may not be implemented) assert($promise instanceof PromiseInterface); assert(method_exists($promise, 'then')); if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'otherwise')); } if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'always')); } if ($promise instanceof CancellablePromiseInterface) { assert(method_exists($promise, 'cancel')); } // new (single PromiseInterface with all methods) assert($promise instanceof PromiseInterface); assert(method_exists($promise, 'then')); assert(method_exists($promise, 'catch')); assert(method_exists($promise, 'finally')); assert(method_exists($promise, 'cancel')); -
Feature / BC break: Improve type safety of promises. Require
mixedfulfillment value argument andThrowable(orException) as rejection reason. Add PHPStan template types to ensure strict types forresolve(T $value): PromiseInterface<T>andreject(Throwable $reason): PromiseInterface<never>. It is no longer possible to resolve a promise without a value (usenullinstead) or reject a promise without a reason (useThrowableinstead). (#93, #141 and #142 by @jsor, #138, #149 and #247 by @WyriHaximus and #213 and #246 by @clue)// old (arguments used to be optional) $promise = resolve(); $promise = reject(); // new (already supported before) $promise = resolve(null); $promise = reject(new RuntimeException()); -
Feature / BC break: Report all unhandled rejections by default and remove
method. Add newdone()set_rejection_handler()function to set the global rejection handler for unhandled promise rejections. (#248, #249 and #224 by @clue)// Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 reject(new RuntimeException('Unhandled')); -
BC break: Remove all deprecated APIs and reduce API surface. Remove
,some(),map()functions, usereduce()any()andall()functions instead. Remove internalandFulfilledPromiseclasses, useRejectedPromiseresolve()andreject()functions instead. Remove legacy promise progress API (deprecated third argument tothen()method) and deprecatedclass. (#32 and #98 by @jsor and #164, #219 and #220 by @clue)LazyPromise -
BC break: Make all classes final to encourage composition over inheritance. (#80 by @jsor)
-
Feature / BC break: Require
array(oriterable) type forall()+race()+any()functions and bring in line with ES6 specification. These functions now require a single argument with a variable number of promises or values as input. (#225 by @clue and #35 by @jsor) -
Fix / BC break: Fix
race()to return a forever pending promise when called with an emptyarray(oriterable) and bring in line with ES6 specification. (#83 by @jsor and #225 by @clue) -
Minor performance improvements by initializing
Deferredin the constructor and avoidingcall_user_func()calls. (#151 by @WyriHaximus and #171 by @Kubo2) -
Minor documentation improvements. (#110 by @seregazhuk, #132 by @CharlotteDunois, #145 by @danielecr, #178 by @WyriHaximus, #189 by @srdante, #212 by @clue, #214, #239 and #243 by @SimonFrings and #231 by @nhedger)
The following changes had to be ported to this release due to our branching strategy, but also appeared in the
2.xbranch:-
Feature: Support union types and address deprecation of
ReflectionType::getClass()(PHP 8+). (#197 by @cdosoftei and @SimonFrings) -
Feature: Support intersection types (PHP 8.1+). (#209 by @bzikarsky)
-
Feature: Support DNS types (PHP 8.2+). (#236 by @nhedger)
-
Feature: Port all memory improvements from
2.xto3.x. (#150 by @clue and @WyriHaximus) -
Fix: Fix checking whether cancellable promise is an object and avoid possible warning. (#161 by @smscr)
-
Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. (#134 by @WyriHaximus)
-
Improve test suite, update PHPUnit and PHP versions and add
.gitattributesto exclude dev files from exports. (#107 by @carusogabriel, #148 and #234 by @WyriHaximus, #153 by @reedy, #162, #230 and #240 by @clue, #173, #177, #185 and #199 by @SimonFrings, #193 by @woodongwong and #210 by @bzikarsky)
The following changes were originally planned for this release but later reverted and are not part of the final release:
-
Add iterative callback queue handler to avoid recursion (later removed to improve Fiber support). (#28, #82 and #86 by @jsor, #158 by @WyriHaximus and #229 and #238 by @clue)
-
Trigger an
E_USER_ERRORinstead of throwing an exception fromdone()(later removed entiredone()method to globally report unhandled rejections). (#97 by @jsor and #224 and #248 by @clue) -
Add type declarations for
some()(later removed entiresome()function). (#172 by @WyriHaximus and #219 by @clue)
-
-
v2.11.016 Nov 2023Release notes
Open source →This is a compatibility release to ensure a smooth upgrade path for those not yet
on Promise v3. We encourage upgrading to the latest version when possible, as
Promise v3 will be the way forward for this project. -
v2.10.002 May 2023Release notes
Open source → -
v2.9.011 Feb 2022Release notes
Open source →-
Feature: Support union types and address deprecation of
ReflectionType::getClass()(PHP 8+).
(#198 by @cdosoftei and @SimonFrings)$promise->otherwise(function (OverflowException|UnderflowException $e) { echo 'Error: ' . $e->getMessage() . PHP_EOL; });
-
Feature: Support intersection types (PHP 8.1+).
(#195 by @bzikarsky)$promise->otherwise(function (OverflowException&CacheException $e) { echo 'Error: ' . $e->getMessage() . PHP_EOL; });
-
Improve test suite, use GitHub actions for continuous integration (CI),
update to PHPUnit 9, and add full core team to the license.
(#174, #183, #186, and #201 by @SimonFrings and #211 by @clue)
-
-
v2.8.012 May 2020Release notes
Open source →-
Mark
FulfilledPromise,RejectedPromiseandLazyPromiseas deprecated for Promise v2 (and remove for Promise v3).
(#143 and #165 by @clue)// deprecated $fulfilled = new React\Promise\FulfilledPromise($value); $rejected = new React\Promise\RejectedPromise($reason); // recommended alternatives $fulfilled = React\Promise\resolve($value); $rejected = React\Promise\reject($reason);
-
Fix: Fix checking whether cancellable promise is an object and avoid possible warning.
(#168 by @smscr and @jsor) -
Improve documentation and add docblocks to functions and interfaces.
(#135 by @CharlotteDunois) -
Add
.gitattributesto exclude dev files from exports.
(#154 by @reedy) -
Improve test suite, run tests on PHP 7.4 and update PHPUnit test setup.
(#163 by @clue)
-
-
v2.7.107 Jan 2019Release notes
Open source →- Fix: file_exists warning when resolving with long strings. (#130 by @sbesselsen)
- Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. (#133 by @WyriHaximus)
-
v2.7.013 Jun 2018Nothing published for this version
-
v2.6.011 Jun 2018Nothing published for this version
-
v2.5.125 Mar 2017Nothing published for this version
-
v2.5.022 Dec 2016Nothing published for this version
-
v2.4.103 May 2016Nothing published for this version
-
v2.4.031 Mar 2016Nothing published for this version
-
v2.3.024 Mar 2016Nothing published for this version
-
v2.2.226 Feb 2016Nothing published for this version
-
v2.2.103 Jul 2015Nothing published for this version
-
v2.2.030 Dec 2014Nothing published for this version
-
v2.1.015 Oct 2014Nothing published for this version
-
v2.0.010 Dec 2013 -
v1.3.016 Nov 2023Release notes
Open source →This is a compatibility release to ensure a smooth upgrade path for those not
yet on Promise v3. We encourage upgrading to the latest version when possible,
as Promise v3 will be the way forward for this project. -
v1.2.107 Mar 2016Nothing published for this version
-
v1.2.027 Feb 2016Nothing published for this version
-
v1.1.001 Jul 2015Nothing published for this version
-
v1.0.403 Apr 2013Nothing published for this version
-
v1.0.317 Nov 2012Nothing published for this version
-
v1.0.214 Nov 2012Nothing published for this version
-
v1.0.113 Nov 2012Nothing published for this version
-
v1.0.007 Nov 2012