https://github.com/php-internal/promise
Improved React Promise package
https://github.com/php-internal/promise
Last synced: 6 months ago
JSON representation
Improved React Promise package
- Host: GitHub
- URL: https://github.com/php-internal/promise
- Owner: php-internal
- License: mit
- Created: 2025-08-26T12:49:23.000Z (11 months ago)
- Default Branch: 3.x
- Last Pushed: 2025-10-24T08:58:43.000Z (9 months ago)
- Last Synced: 2025-10-24T10:26:51.116Z (9 months ago)
- Language: PHP
- Size: 902 KB
- Stars: 35
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Promise
A lightweight implementation of [CommonJS Promises/A][CommonJS Promises/A] for PHP.
> [!NOTE]
> This is a fork of [reactphp/promise][reactphp/promise].
>
> Improvements over original reactphp/promise:
>
> - PHP 8.1+ compatibility
> - `declare(strict_types=1);` in all PHP files
> - `@yield` annotation in the PromiseInterface
>
> Version 3.x specific:
> - Replaces `react/promise` v3 in Composer
> - Rejection handler is reusable now. `error_log()` is still used by default.
> - Removed `exit(255)` from RejectionPromise.
>
> Version 2.x specific:
> - Replaces `react/promise` v2 in Composer
> - Enhanced type annotations
## Install
```bash
composer require internal/promise
```
[](https://packagist.org/packages/internal/promise)
[](https://packagist.org/packages/internal/promise)
[](LICENSE.md)
[](https://packagist.org/packages/buggregator/trap)
## Tests
To run the test suite, go to the project root and run:
```bash
composer test
```
On top of this, we use PHPStan on max level to ensure type safety across the project:
```bash
composer stan
```
## Credits
This fork is based on [reactphp/promise][reactphp/promise], which is a port of [when.js][when.js]
by [Brian Cavalier][Brian Cavalier].
Also, large parts of the [documentation][documentation] have been ported from the when.js
[Wiki][Wiki] and the
[API docs][API docs].
[documentation]: documentation.md
[CommonJS Promises/A]: http://wiki.commonjs.org/wiki/Promises/A
[CI status]: https://img.shields.io/github/actions/workflow/status/internal/promise/ci.yml?branch=2.x
[CI status link]: https://github.com/internal/promise/actions
[installs]: https://img.shields.io/packagist/dt/internal/promise?color=blue&label=installs%20on%20Packagist
[packagist link]: https://packagist.org/packages/internal/promise
[Composer]: https://getcomposer.org
[when.js]: https://github.com/cujojs/when
[Brian Cavalier]: https://github.com/briancavalier
[reactphp/promise]: https://github.com/reactphp/promise
[Wiki]: https://github.com/cujojs/when/wiki
[API docs]: https://github.com/cujojs/when/blob/master/docs/api.md