diff --git a/assets/.htaccess b/assets/.htaccess new file mode 100644 index 000000000..efa53b69c --- /dev/null +++ b/assets/.htaccess @@ -0,0 +1,33 @@ + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + # CSS + ExpiresByType text/css "access plus 1 year" + + # JavaScript + ExpiresByType application/javascript "access plus 1 year" + ExpiresByType application/x-javascript "access plus 1 year" + ExpiresByType text/javascript "access plus 1 year" + + # Web fonts + + # Embedded OpenType (EOT) + ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + ExpiresByType font/eot "access plus 1 month" + + # OpenType + ExpiresByType font/opentype "access plus 1 month" + + # TrueType + ExpiresByType application/x-font-ttf "access plus 1 month" + + # Web Open Font Format (WOFF) 1.0 + ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/x-font-woff "access plus 1 month" + ExpiresByType font/woff "access plus 1 month" + + # Web Open Font Format (WOFF) 2.0 + ExpiresByType application/font-woff2 "access plus 1 month" + + diff --git a/assets/0.6a34aef149239e7a6f57.js b/assets/0.6a34aef149239e7a6f57.js new file mode 100644 index 000000000..a2f5e687c --- /dev/null +++ b/assets/0.6a34aef149239e7a6f57.js @@ -0,0 +1 @@ +webpackJsonp([0],Array(33).concat([function(t,e,n){var i=n(54);"string"==typeof i&&(i=[[t.i,i,""]]);var o={};o.transform=void 0;n(32)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){"use strict";var i=n(55),o=function(t){return t&&t.__esModule?t:{default:t}}(i);t.exports=o.default},function(t,e,n){"use strict";function i(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var o=n(36);t.exports={isArray:null,isFunction:null,isObject:null,bind:null,each:null,map:null,mixin:null,isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isNumber:function(t){return"number"==typeof t},toStr:function(t){return void 0===t||null===t?"":t+""},cloneDeep:function(t){var e=this.mixin({},t),n=this;return this.each(e,function(t,i){t&&(n.isArray(t)?e[i]=[].concat(t):n.isObject(t)&&(e[i]=n.cloneDeep(t)))}),e},error:function(t){throw new Error(t)},every:function(t,e){var n=!0;return t?(this.each(t,function(i,o){if(!(n=e.call(null,i,o,t)))return!1}),!!n):n},any:function(t,e){var n=!1;return t?(this.each(t,function(i,o){if(e.call(null,i,o,t))return n=!0,!1}),n):n},getUniqueId:function(){var t=0;return function(){return t++}}(),templatify:function(t){if(this.isFunction(t))return t;var e=o.element(t);return"SCRIPT"===e.prop("tagName")?function(){return e.text()}:function(){return String(t)}},defer:function(t){setTimeout(t,0)},noop:function(){},formatPrefix:function(t,e){return e?"":t+"-"},className:function(t,e,n){return(n?"":".")+t+e},escapeHighlightedString:function(t,e,n){e=e||"";var o=document.createElement("div");o.appendChild(document.createTextNode(e)),n=n||"";var r=document.createElement("div");r.appendChild(document.createTextNode(n));var s=document.createElement("div");return s.appendChild(document.createTextNode(t)),s.innerHTML.replace(RegExp(i(o.innerHTML),"g"),e).replace(RegExp(i(r.innerHTML),"g"),n)}}},function(t,e,n){"use strict";t.exports={element:null}},function(t,e){var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString;t.exports=function(t,e,o){if("[object Function]"!==i.call(e))throw new TypeError("iterator must be a function");var r=t.length;if(r===+r)for(var s=0;s=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function r(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var i="color: "+this.color;t.splice(1,0,i,"color: inherit");var o=0,r=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(r=o))}),t.splice(r,0,i)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function u(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==i&&"env"in i&&(t=i.env.DEBUG),t}e=t.exports=n(72),e.log=s,e.formatArgs=r,e.save=a,e.load=u,e.useColors=o,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(u())}).call(e,n(3))},function(t,e,n){"use strict";function i(t,e){var i=n(37),o=this;"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):o.stack=(new Error).stack||"Cannot get a stacktrace, browser is too old",this.name="AlgoliaSearchError",this.message=t||"Unknown error",e&&i(e,function(t,e){o[e]=t})}function o(t,e){function n(){var n=Array.prototype.slice.call(arguments,0);"string"!=typeof n[0]&&n.unshift(e),i.apply(this,n),this.name="AlgoliaSearch"+t+"Error"}return r(n,i),n}var r=n(45);r(i,Error),t.exports={AlgoliaSearchError:i,UnparsableJSON:o("UnparsableJSON","Could not parse the incoming response as JSON, see err.more for details"),RequestTimeout:o("RequestTimeout","Request timedout before getting a response"),Network:o("Network","Network issue, see err.more for details"),JSONPScriptFail:o("JSONPScriptFail"," - - - - - - - -
- -
- -
-
-
-
-

Async Changelog

- - - -

- - 2024 -

- - -

- - - 4.3.0 - - - (2024-06-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve performance by avoiding unneeded references in FiberMap.
    -(#88 by @clue)

    -
  • -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#87 by @clue)

    -
  • -
  • -

    Improve type safety for test environment.
    -(#86 by @SimonFrings)

    -
  • -
- -
-

- - 2023 -

- - -

- - - 4.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#40 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', async(fn(): bool => true)());
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#81 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#79 by @clue)

    -
  • -
- -
- -

- - - 3.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This release contains backported features from the Async v4.2.0 release for those
-not yet on PHP 8.1+. Async v3 provides a compatible API, but may not take advantage
-of newer language features. We encourage upgrading to the latest version when possible.

-
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#82 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#83 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#80 by @clue)

    -
  • -
- -
- -

- - - 2.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This is a compatibility release to ensure a smooth upgrade path for those not yet
-on Async v4 or v3. We encourage upgrading to the latest version when possible, as
-Async v4 will be the way forward for this project.

-
    -
  • Feature: Full PHP 8.3 compatibility.
    -(#84 by @clue)
  • -
- -
- -

- - - 4.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#69 and #78 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#66 and #76 by @clue and #61 and #73 by @WyriHaximus)

    -
  • -
- -
- -

- - - 3.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#71 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#67 and #77 by @clue and #60 and #74 by @WyriHaximus)

    -
  • -
- -
- -

- - - 2.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#72 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, run tests on PHP 8.2 and report failed assertions.
    -(#59 and #75 by @WyriHaximus and #68 by @clue)

    -
  • -
- -
-

- - 2022 -

- - -

- - - 4.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v3.0.0 release. 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:

-
    -
  • -

    Feature / BC break: Require PHP 8.1+ and add mixed type declarations.
    -(#14 by @clue)

    -
  • -
  • -

    Feature: Add Fiber-based async() and await() functions.
    -(#15, #18, #19 and #20 by @WyriHaximus and #26, #28, #30, #32, #34, #55 and #57 by @clue)

    -
  • -
  • -

    Project maintenance, rename main branch to 4.x and update installation instructions.
    -(#29 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v3.0.0 release:

-
    -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#49 by @clue)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#48 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#36 by @SimonFrings and #51 by @nhedger)

    -
  • -
- -
- -

- - - 3.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v2.0.0 release. 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:

-
    -
  • -

    Feature / BC break: Require PHP 7.1+ and add type declarations.
    -(#11 by @clue)

    -
  • -
  • -

    Feature: Add Generator-based coroutine() function.
    -(#12, #13 and #54 by @clue)

    -
  • -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#45 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v2.0.0 release:

-
    -
  • -

    Feature: Only stop loop for await() if a pending promise resolves/rejects.
    -(#33 by @SimonFrings)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#47 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#37 by @SimonFrings and #52 by @nhedger)

    -
  • -
- -
- -

- - - 2.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major changes over the previous v1.0.0 release that
-has been deprecated since 2013. Accordingly, most consumers of this package
-should not be affected by any BC breaks. See below for more details:

-
    -
  • -

    Feature / BC break: Change to Promise-based APIs instead of callbacks (continuation-passing style).
    -Support promise cancellation and upcoming Promise v3.
    -(#6, #7, #9 and #46 by @clue)

    -
  • -
  • -

    Feature: Add new await() function (import from clue/reactphp-block).
    -(#8 by @clue and #39 by @SimonFrings)

    -
  • -
  • -

    Minor documentation improvements.
    -(#38 by @SimonFrings and #53 by @nhedger)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHP 8.1, PHPUnit 9, switch to GitHub actions and clean up test suite.
    -(#2, #3, #4, #5 and #10 by @clue)

    -
  • -
- -
-

- - 2013 -

- - -

- - - 1.0.0 - - - (2013-02-06) - - Release on GitHub - - -

- -
-

Imported release from original tag date 2013-02-06.

-
-
    -
  • First tagged release
  • -
- -
- - -
- -
-
-
- - - - diff --git a/async/index.html b/async/index.html deleted file mode 100644 index 613a1aaa1..000000000 --- a/async/index.html +++ /dev/null @@ -1,932 +0,0 @@ - - - - - - - - Async: Async Utilities - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-

Async

- -

Async Utilities

-

CI status -installs on Packagist

-

Async utilities and fibers for ReactPHP.

-

This library allows you to manage async control flow. It provides a number of -combinators for Promise-based APIs. -Instead of nesting or chaining promise callbacks, you can declare them as a -list, which is resolved sequentially in an async manner. -React/Async will not automagically change blocking code to be async. You need -to have an actual event loop and non-blocking libraries interacting with that -event loop for it to work. As long as you have a Promise-based API that runs in -an event loop, it can be used with this library.

-

Table of Contents

- -

Usage

-

This lightweight library consists only of a few simple functions. -All functions reside under the React\Async namespace.

-

The below examples refer to all functions with their fully-qualified names like this:

-
React\Async\await(…);
-

As of PHP 5.6+ you can also import each required function into your code like this:

-
use function React\Async\await;
-
-await(…);
-

Alternatively, you can also use an import statement similar to this:

-
use React\Async;
-
-Async\await(…);
-

async()

-

The async(callable():(PromiseInterface<T>|T) $function): (callable():PromiseInterface<T>) function can be used to -return an async function for a function that uses await() internally.

-

This function is specifically designed to complement the await() function. -The await() function can be considered blocking from the -perspective of the calling code. You can avoid this blocking behavior by -wrapping it in an async() function call. Everything inside this function -will still be blocked, but everything outside this function can be executed -asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    React\Async\await(React\Promise\Timer\sleep(1.0));
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the await() function for more details.

-

Note that this function only works in tandem with the await() function. -In particular, this function does not "magically" make any blocking function -non-blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    sleep(1); // broken: using PHP's blocking sleep() for demonstration purposes
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "c" at t=1.5s: Correct timing, but wrong order
-// prints "b" at t=1.5s: Triggered too late because it was blocked
-

As an alternative, you should always make sure to use this function in tandem -with the await() function and an async API returning a promise -as shown in the previous example.

-

The async() function is specifically designed for cases where it is used -as a callback (such as an event loop timer, event listener, or promise -callback). For this reason, it returns a new function wrapping the given -$function instead of directly invoking it and returning its value.

-
use function React\Async\async;
-
-Loop::addTimer(1.0, async(function () { … }));
-$connection->on('close', async(function () { … }));
-$stream->on('data', async(function ($data) { … }));
-$promise->then(async(function (int $result) { … }));
-

You can invoke this wrapping function to invoke the given $function with -any arguments given as-is. The function will always return a Promise which -will be fulfilled with whatever your $function returns. Likewise, it will -return a promise that will be rejected if you throw an Exception or -Throwable from your $function. This allows you to easily create -Promise-based functions:

-
$promise = React\Async\async(function (): int {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $bytes = 0;
-    foreach ($urls as $url) {
-        $response = React\Async\await($browser->get($url));
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-})();
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The previous example uses await() inside a loop to highlight how -this vastly simplifies consuming asynchronous operations. At the same time, -this naive example does not leverage concurrent execution, as it will -essentially "await" between each operation. In order to take advantage of -concurrent execution within the given $function, you can "await" multiple -promises by using a single await() together with Promise-based -primitives like this:

-
$promise = React\Async\async(function (): int {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $promises = [];
-    foreach ($urls as $url) {
-        $promises[] = $browser->get($url);
-    }
-
-    try {
-        $responses = React\Async\await(React\Promise\all($promises));
-    } catch (Exception $e) {
-        foreach ($promises as $promise) {
-            $promise->cancel();
-        }
-        throw $e;
-    }
-
-    $bytes = 0;
-    foreach ($responses as $response) {
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-})();
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The returned promise is implemented in such a way that it can be cancelled -when it is still pending. Cancelling a pending promise will cancel any awaited -promises inside that fiber or any nested fibers. As such, the following example -will only output ab and cancel the pending delay(). -The await() calls in this example would throw a RuntimeException -from the cancelled delay() call that bubbles up through the fibers.

-
$promise = async(static function (): int {
-    echo 'a';
-    await(async(static function (): void {
-        echo 'b';
-        delay(2);
-        echo 'c';
-    })());
-    echo 'd';
-
-    return time();
-})();
-
-$promise->cancel();
-await($promise);
-

await()

-

The await(PromiseInterface<T> $promise): T function can be used to -block waiting for the given $promise to be fulfilled.

-
$result = React\Async\await($promise);
-

This function will only return after the given $promise has settled, i.e. -either fulfilled or rejected. While the promise is pending, this function -can be considered blocking from the perspective of the calling code. -You can avoid this blocking behavior by wrapping it in an async() function -call. Everything inside this function will still be blocked, but everything -outside this function can be executed asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    React\Async\await(React\Promise\Timer\sleep(1.0));
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the async() function for more details.

-

Once the promise is fulfilled, this function will return whatever the promise -resolved to.

-

Once the promise is rejected, this will throw whatever the promise rejected -with. If the promise did not reject with an Exception or Throwable, then -this function will throw an UnexpectedValueException instead.

-
try {
-    $result = React\Async\await($promise);
-    // promise successfully fulfilled with $result
-    echo 'Result: ' . $result;
-} catch (Throwable $e) {
-    // promise rejected with $e
-    echo 'Error: ' . $e->getMessage();
-}
-

coroutine()

-

The coroutine(callable(mixed ...$args):(\Generator|PromiseInterface<T>|T) $function, mixed ...$args): PromiseInterface<T> function can be used to -execute a Generator-based coroutine to "await" promises.

-
React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-
-    try {
-        $response = yield $browser->get('https://example.com/');
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        echo $response->getBody();
-    } catch (Exception $e) {
-        echo 'Error: ' . $e->getMessage() . PHP_EOL;
-    }
-});
-

Using Generator-based coroutines is an alternative to directly using the -underlying promise APIs. For many use cases, this makes using promise-based -APIs much simpler, as it resembles a synchronous code flow more closely. -The above example performs the equivalent of directly using the promise APIs:

-
$browser = new React\Http\Browser();
-
-$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
-    echo $response->getBody();
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The yield keyword can be used to "await" a promise resolution. Internally, -it will turn the entire given $function into a Generator. -This allows the execution to be interrupted and resumed at the same place -when the promise is fulfilled. The yield statement returns whatever the -promise is fulfilled with. If the promise is rejected, it will throw an -Exception or Throwable.

-

The coroutine() function will always return a Promise which will be -fulfilled with whatever your $function returns. Likewise, it will return -a promise that will be rejected if you throw an Exception or Throwable -from your $function. This allows you to easily create Promise-based -functions:

-
$promise = React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $bytes = 0;
-    foreach ($urls as $url) {
-        $response = yield $browser->get($url);
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-});
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The previous example uses a yield statement inside a loop to highlight how -this vastly simplifies consuming asynchronous operations. At the same time, -this naive example does not leverage concurrent execution, as it will -essentially "await" between each operation. In order to take advantage of -concurrent execution within the given $function, you can "await" multiple -promises by using a single yield together with Promise-based primitives -like this:

-
$promise = React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $promises = [];
-    foreach ($urls as $url) {
-        $promises[] = $browser->get($url);
-    }
-
-    try {
-        $responses = yield React\Promise\all($promises);
-    } catch (Exception $e) {
-        foreach ($promises as $promise) {
-            $promise->cancel();
-        }
-        throw $e;
-    }
-
-    $bytes = 0;
-    foreach ($responses as $response) {
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-});
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

delay()

-

The delay(float $seconds): void function can be used to -delay program execution for duration given in $seconds.

-
React\Async\delay($seconds);
-

This function will only return after the given number of $seconds have -elapsed. If there are no other events attached to this loop, it will behave -similar to PHP's sleep() function.

-
echo 'a';
-React\Async\delay(1.0);
-echo 'b';
-
-// prints "a" at t=0.0s
-// prints "b" at t=1.0s
-

Unlike PHP's sleep() function, -this function may not necessarily halt execution of the entire process thread. -Instead, it allows the event loop to run any other events attached to the -same loop until the delay returns:

-
echo 'a';
-Loop::addTimer(1.0, function (): void {
-    echo 'b';
-});
-React\Async\delay(3.0);
-echo 'c';
-
-// prints "a" at t=0.0s
-// prints "b" at t=1.0s
-// prints "c" at t=3.0s
-

This behavior is especially useful if you want to delay the program execution -of a particular routine, such as when building a simple polling or retry -mechanism:

-
try {
-    something();
-} catch (Throwable) {
-    // in case of error, retry after a short delay
-    React\Async\delay(1.0);
-    something();
-}
-

Because this function only returns after some time has passed, it can be -considered blocking from the perspective of the calling code. You can avoid -this blocking behavior by wrapping it in an async() function call. -Everything inside this function will still be blocked, but everything outside -this function can be executed asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function (): void {
-    echo 'a';
-    React\Async\delay(1.0);
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function (): void {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the async() function for more details.

-

Internally, the $seconds argument will be used as a timer for the loop so that -it keeps running until this timer triggers. This implies that if you pass a -really small (or negative) value, it will still start a timer and will thus -trigger at the earliest possible time in the future.

-

The function is implemented in such a way that it can be cancelled when it is -running inside an async() function. Cancelling the resulting -promise will clean up any pending timers and throw a RuntimeException from -the pending delay which in turn would reject the resulting promise.

-
$promise = async(function (): void {
-    echo 'a';
-    delay(3.0);
-    echo 'b';
-})();
-
-Loop::addTimer(2.0, function () use ($promise): void {
-    $promise->cancel();
-});
-
-// prints "a" at t=0.0s
-// rejects $promise at t=2.0
-// never prints "b"
-

parallel()

-

The parallel(iterable<callable():PromiseInterface<T>> $tasks): PromiseInterface<array<T>> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-React\Async\parallel([
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for a whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for another whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for yet another whole second');
-            });
-        });
-    },
-])->then(function (array $results) {
-    foreach ($results as $result) {
-        var_dump($result);
-    }
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

series()

-

The series(iterable<callable():PromiseInterface<T>> $tasks): PromiseInterface<array<T>> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-React\Async\series([
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for a whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for another whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for yet another whole second');
-            });
-        });
-    },
-])->then(function (array $results) {
-    foreach ($results as $result) {
-        var_dump($result);
-    }
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

waterfall()

-

The waterfall(iterable<callable(mixed=):PromiseInterface<T>> $tasks): PromiseInterface<T> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-$addOne = function ($prev = 0) {
-    return new Promise(function ($resolve) use ($prev) {
-        Loop::addTimer(1, function () use ($prev, $resolve) {
-            $resolve($prev + 1);
-        });
-    });
-};
-
-React\Async\waterfall([
-    $addOne,
-    $addOne,
-    $addOne
-])->then(function ($prev) {
-    echo "Final result is $prev\n";
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

Todo

-
    -
  • Implement queue()
  • -
-

Install

-

The recommended way to install this library is through Composer. -New to Composer?

-

This project follows SemVer. -This will install the latest supported version from this branch:

-
composer require react/async:^4.3
-

See also the CHANGELOG for details about version upgrades.

-

This project aims to run on any platform and thus does not require any PHP -extensions and supports running on PHP 8.1+. -It's highly recommended to use the latest supported PHP version for this project.

-

We're committed to providing long-term support (LTS) options and to provide a -smooth upgrade path. If you're using an older PHP version, you may use the -3.x branch (PHP 7.1+) or -2.x branch (PHP 5.3+) which both -provide a compatible API but do not take advantage of newer language features. -You may target multiple versions at the same time to support a wider range of -PHP versions like this:

-
composer require "react/async:^4 || ^3 || ^2"
-

Tests

-

To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

-
composer install
-

To run the test suite, go to the project root and run:

-
vendor/bin/phpunit
-

On top of this, we use PHPStan on max level to ensure type safety across the project:

-
vendor/bin/phpstan
-

License

-

MIT, see LICENSE file.

-

This project is heavily influenced by async.js.

-
- -
-
-
- - - - diff --git a/async/license.html b/async/license.html deleted file mode 100644 index ba50c60fd..000000000 --- a/async/license.html +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - Async: License - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-

Async License

- -

Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

-

Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions:

-

The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software.

-

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.

-
- -
-
-
- - - - diff --git a/cache/changelog.html b/cache/changelog.html index 14f226e64..c0dc5b7c2 100644 --- a/cache/changelog.html +++ b/cache/changelog.html @@ -20,15 +20,17 @@ - - + - - - - - - + + + + + + + + +
@@ -41,7 +43,7 @@
-
-
- - -
-
-

Changelog

-

The combined changelog for all ReactPHP components.

- - - - -

- - 2025 -

- - -

- - - ChildProcess 0.6.7 - - - (2025-12-23) - - Release on GitHub - - -

- -

Just in time for the holidays, we are happy to announce the release of v0.6.7! 🎄🎉

-

This is a compatibility release that contains backported features from the 0.7.x branch.
-Once v0.7 is released, it will be the way forward for this project.

- - -
- -

- - - Socket 1.17.0 - - - (2025-11-19) - - Release on GitHub - - -

- - - -
- -

- - - DNS 1.14.0 - - - (2025-11-18) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve PHP 8.5+ support by avoiding deprecated setAccessible() calls.
    -(#238 by @W0rma and #243 by @WyriHaximus)

    -
  • -
  • -

    Improve test suite, update test environment and increase query count in excessive TCP query tests.
    -(#239 and #240 by @WyriHaximus)

    -
  • -
- -
- -

- - - EventLoop 1.6.0 - - - (2025-11-17) - - Release on GitHub - - -

- -
    -
  • Feature: Improve PHP 8.5+ support by avoiding deprecated method calls.
    -(#280 and #282 by @WyriHaximus)
  • -
- -
- -

- - - Promise 3.3.0 - - - (2025-08-19) - - Release on GitHub - - -

- -
    -
  • -

    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)

    -
  • -
- -
- -

- - - ChildProcess 0.6.6 - - - (2025-01-01) - - Release on GitHub - - -

- -

This is a compatibility release that contains backported features from the 0.7.x branch.
-Once v0.7 is released, it will be the way forward for this project.

-
    -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable types.
    -(#114 by @clue)

    -
  • -
  • -

    Improve test suite to run tests on latest PHP versions and report failed assertions.
    -(#113 by @clue)

    -
  • -
- -
-

- - 2024 -

- - -

- - - HTTP 1.11.0 - - - (2024-11-20) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable types.
    -(#537 by @clue)

    -
  • -
  • -

    Feature: Allow underscore character in Uri host.
    -(#524 by @lulhum)

    -
  • -
  • -

    Improve test suite to fix expected error code when ext-sockets is not enabled.
    -(#539 by @WyriHaximus)

    -
  • -
- -
- -

- - - Datagram 1.10.0 - - - (2024-09-06) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#59 by @clue)

    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#57 by @clue)

    -
  • -
- -
- -

- - - Socket 1.16.0 - - - (2024-07-26) - - Release on GitHub - - -

- -
    -
  • Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#318 by @clue)
  • -
- -
- -

- - - DNS 1.13.0 - - - (2024-06-13) - - Release on GitHub - - -

- -
    -
  • Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#224 by @WyriHaximus)
  • -
- -
- -

- - - Stream 1.4.0 - - - (2024-06-11) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#179 by @clue)

    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#172 by @clue)

    -
  • -
  • -

    Fix: Fix drain event of ThroughStream to handle potential race condition.
    -(#171 by @clue)

    -
  • -
- -
- -

- - - Async 4.3.0 - - - (2024-06-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve performance by avoiding unneeded references in FiberMap.
    -(#88 by @clue)

    -
  • -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#87 by @clue)

    -
  • -
  • -

    Improve type safety for test environment.
    -(#86 by @SimonFrings)

    -
  • -
- -
- -

- - - PromiseTimer 1.11.0 - - - (2024-06-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#70 by @clue)

    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#68 by @clue)

    -
  • -
- -
- -

- - - Promise 3.2.0 - - - (2024-05-24) - - Release on GitHub - - -

- -
    -
  • -

    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)

    -
  • -
- -
- -

- - - HTTP 1.10.0 - - - (2024-03-27) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new PSR-7 implementation and remove dated RingCentral PSR-7 dependency.
    -(#518, #519, #520 and #522 by @clue)

    -

    This changeset allows us to maintain our own PSR-7 implementation and reduce
    -dependencies on external projects. It also improves performance slightly and
    -does not otherwise affect our public API. If you want to explicitly install
    -the old RingCentral PSR-7 dependency, you can still install it like this:

    -
    composer require ringcentral/psr7
    -
  • -
  • -

    Feature: Add new Uri class for new PSR-7 implementation.
    -(#521 by @clue)

    -
  • -
  • -

    Feature: Validate outgoing HTTP message headers and reject invalid messages.
    -(#523 by @clue)

    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#508 by @clue)

    -
  • -
  • -

    Fix: Fix HTTP client to omit Transfer-Encoding: chunked when streaming empty request body.
    -(#516 by @clue)

    -
  • -
  • -

    Fix: Ensure connection close handler is cleaned up for each request.
    -(#515 by @WyriHaximus)

    -
  • -
  • -

    Update test suite and avoid unhandled promise rejections.
    -(#501 and #502 by @clue)

    -
  • -
- -
-

- - 2023 -

- - -

- - - Socket 1.15.0 - - - (2023-12-15) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#310 by @clue)

    -
  • -
  • -

    Fix: Fix cancelling during the 50ms resolution delay when DNS is still pending.
    -(#311 by @clue)

    -
  • -
- -
- -

- - - PromiseStream 1.7.0 - - - (2023-12-13) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#39 by @clue)

    -
  • -
  • -

    Update test suite and collect all garbage cycles.
    -(#38 and #39 by @clue)

    -
  • -
- -
- -

- - - DNS 1.12.0 - - - (2023-11-29) - - Release on GitHub - - -

- - - -
- -

- - - Async 4.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#40 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', async(fn(): bool => true)());
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#81 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#79 by @clue)

    -
  • -
- -
- -

- - - Async 3.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This release contains backported features from the Async v4.2.0 release for those
-not yet on PHP 8.1+. Async v3 provides a compatible API, but may not take advantage
-of newer language features. We encourage upgrading to the latest version when possible.

-
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#82 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#83 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#80 by @clue)

    -
  • -
- -
- -

- - - Async 2.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This is a compatibility release to ensure a smooth upgrade path for those not yet
-on Async v4 or v3. We encourage upgrading to the latest version when possible, as
-Async v4 will be the way forward for this project.

-
    -
  • Feature: Full PHP 8.3 compatibility.
    -(#84 by @clue)
  • -
- -
- -

- - - Promise 3.1.0 - - - (2023-11-16) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#255 by @clue)

    -
  • -
  • -

    Feature: Describe all callable arguments with types for Promise and Deferred.
    -(#253 by @clue)

    -
  • -
  • -

    Update test suite and minor documentation improvements.
    -(#251 by @ondrejmirtes and #250 by @SQKo)

    -
  • -
- -
- -

- - - Promise 2.11.0 - - - (2023-11-16) - - Release on GitHub - - -

- -

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.

-
    -
  • Feature: Full PHP 8.3 compatibility.
    -(#256 by @clue)
  • -
- -
- -

- - - Promise 1.3.0 - - - (2023-11-16) - - Release on GitHub - - -

- -

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.

- - -
- -

- - - EventLoop 1.5.0 - - - (2023-11-13) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve performance by using spl_object_id() on PHP 7.2+.
    -(#267 by @samsonasik)

    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#269 by @clue)

    -
  • -
  • -

    Update tests for ext-uv on PHP 8+ and legacy PHP.
    -(#270 by @clue and #268 by @SimonFrings)

    -
  • -
- -
- -

- - - Socket 1.14.0 - - - (2023-08-25) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve Promise v3 support and use template types.
    -(#307 and #309 by @clue)

    -
  • -
  • -

    Improve test suite and update to collect all garbage cycles.
    -(#308 by @clue)

    -
  • -
- -
- -

- - - PromiseTimer 1.10.0 - - - (2023-07-20) - - Release on GitHub - - -

- - - -
- -

- - - Promise 3.0.0 - - - (2023-07-11) - - Release on GitHub - - -

- -

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.0 release. 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 PromiseInterface now includes the functionality of the old ExtendedPromiseInterface and CancellablePromiseInterface.
    -Each promise now always includes the then(), catch(), finally() and cancel() methods.
    -The new catch() and finally() methods replace the deprecated otherwise() and always() methods which continue to exist for BC reasons.
    -The old ExtendedPromiseInterface and CancellablePromiseInterface are no longer needed and have been removed as a consequence.
    -(#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 mixed fulfillment value argument and Throwable (or Exception) as rejection reason.
    -Add PHPStan template types to ensure strict types for resolve(T $value): PromiseInterface<T> and reject(Throwable $reason): PromiseInterface<never>.
    -It is no longer possible to resolve a promise without a value (use null instead) or reject a promise without a reason (use Throwable instead).
    -(#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 done() method.
    -Add new 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(), reduce() functions, use any() and all() functions instead.
    -Remove internal FulfilledPromise and RejectedPromise classes, use resolve() and reject() functions instead.
    -Remove legacy promise progress API (deprecated third argument to then() method) and deprecated LazyPromise class.
    -(#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 (or iterable) type for all() + 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 empty array (or iterable) and bring in line with ES6 specification.
    -(#83 by @jsor and #225 by @clue)

    -
  • -
  • -

    Minor performance improvements by initializing Deferred in the constructor and avoiding call_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.x branch:

- -

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_ERROR instead of throwing an exception from done() (later removed entire done() method to globally report unhandled rejections).
    -(#97 by @jsor and #224 and #248 by @clue)

    -
  • -
  • -

    Add type declarations for some() (later removed entire some() function).
    -(#172 by @WyriHaximus and #219 by @clue)

    -
  • -
- -
- -

- - - PromiseStream 1.6.0 - - - (2023-07-07) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Update unwrapped stream to avoid unhandled promise rejections.
    -(#37 by @clue)

    -
  • -
  • -

    Feature: Improve first() promise resolution to clean up any garbage references.
    -(#36 by @lucasnetau)

    -
  • -
  • -

    Improve test suite and project setup and report failed assertions.
    -(#34 by @clue and #35 by @WyriHaximus)

    -
  • -
- -
- -

- - - Async 4.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#69 and #78 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#66 and #76 by @clue and #61 and #73 by @WyriHaximus)

    -
  • -
- -
- -

- - - Async 3.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#71 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#67 and #77 by @clue and #60 and #74 by @WyriHaximus)

    -
  • -
- -
- -

- - - Async 2.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#72 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, run tests on PHP 8.2 and report failed assertions.
    -(#59 and #75 by @WyriHaximus and #68 by @clue)

    -
  • -
- -
- -

- - - Stream 1.3.0 - - - (2023-06-16) - - Release on GitHub - - -

- - - -
- -

- - - Socket 1.13.0 - - - (2023-06-07) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Include timeout logic to avoid dependency on reactphp/promise-timer.
    -(#305 by @clue)

    -
  • -
  • -

    Feature: Improve errno detection for failed connections without ext-sockets.
    -(#304 by @clue)

    -
  • -
  • -

    Improve test suite, clean up leftover .sock files and report failed assertions.
    -(#299, #300, #301 and #306 by @clue)

    -
  • -
- -
- -

- - - DNS 1.11.0 - - - (2023-06-02) - - Release on GitHub - - -

- - - -
- -

- - - EventLoop 1.4.0 - - - (2023-05-05) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve performance of Loop by avoiding unneeded method calls.
    -(#266 by @clue)

    -
  • -
  • -

    Feature: Support checking EINTR constant from ext-pcntl without ext-sockets.
    -(#265 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#254 by @nhedger)

    -
  • -
  • -

    Improve test suite, run tests on PHP 8.2 and report failed assertions.
    -(#258 by @WyriHaximus, #264 by @clue and #251, #261 and #262 by @SimonFrings)

    -
  • -
- -
- -

- - - Promise 2.10.0 - - - (2023-05-02) - - Release on GitHub - - -

- - - -
- -

- - - HTTP 1.9.0 - - - (2023-04-26) - - Release on GitHub - - -

- -

This is a SECURITY and feature release for the 1.x series of ReactPHP's HTTP component.

-
    -
  • -

    Security fix: This release fixes a medium severity security issue in ReactPHP's HTTP server component
    -that affects all versions between v0.8.0 and v1.8.0. All users are encouraged to upgrade immediately.
    -(CVE-2023-26044 reported and fixed by @WyriHaximus)

    -
  • -
  • -

    Feature: Support HTTP keep-alive for HTTP client (reusing persistent connections).
    -(#481, #484, #486 and #495 by @clue)

    -

    This feature offers significant performance improvements when sending many
    -requests to the same host as it avoids recreating the underlying TCP/IP
    -connection and repeating the TLS handshake for secure HTTPS requests.

    -
    $browser = new React\Http\Browser();
    -
    -// Up to 300% faster! HTTP keep-alive is enabled by default
    -$response = React\Async\await($browser->get('https://httpbingo.org/redirect/6'));
    -assert($response instanceof Psr\Http\Message\ResponseInterface);
    -
  • -
  • -

    Feature: Add Request class to represent outgoing HTTP request message.
    -(#480 by @clue)

    -
  • -
  • -

    Feature: Preserve request method and body for 307 Temporary Redirect and 308 Permanent Redirect.
    -(#442 by @dinooo13)

    -
  • -
  • -

    Feature: Include buffer logic to avoid dependency on reactphp/promise-stream.
    -(#482 by @clue)

    -
  • -
  • -

    Improve test suite and project setup and report failed assertions.
    -(#478 by @clue, #487 and #491 by @WyriHaximus and #475 and #479 by @SimonFrings)

    -
  • -
- -
-

- - 2022 -

- - -

- - - Datagram 1.9.0 - - - (2022-12-05) - - Release on GitHub - - -

- - - -
- -

- - - Cache 1.2.0 - - - (2022-11-30) - - Release on GitHub - - -

- - - -
- -

- - - HTTP 1.8.0 - - - (2022-09-29) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support for default request headers.
    -(#461 by @51imyy)

    -
    $browser = new React\Http\Browser();
    -$browser = $browser->withHeader('User-Agent', 'ACME');
    -
    -$browser->get($url)->then(…);
    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#460 by @clue)

    -
  • -
- -
- -

- - - ChildProcess 0.6.5 - - - (2022-09-16) - - Release on GitHub - - -

- - - -
- -

- - - PromiseStream 1.5.0 - - - (2022-09-09) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full support for PHP 8.2 release.
    -(#33 by @WyriHaximus)

    -
  • -
  • -

    Improve test suite and minor documentation improvements.
    -(#32 by @clue and #31 by @nhedger)

    -
  • -
- -
- -

- - - DNS 1.10.0 - - - (2022-09-08) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full support for PHP 8.2 release.
    -(#201 by @clue and #207 by @WyriHaximus)

    -
  • -
  • -

    Feature: Optimize forward compatibility with Promise v3, avoid hitting autoloader.
    -(#202 by @clue)

    -
  • -
  • -

    Feature / Fix: Improve error reporting when custom error handler is used.
    -(#197 by @clue)

    -
  • -
  • -

    Fix: Fix invalid references in exception stack trace.
    -(#191 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#195 by @SimonFrings and #203 by @nhedger)

    -
  • -
  • -

    Improve test suite, update to use default loop and new reactphp/async package.
    -(#204, #205 and #206 by @clue and #196 by @SimonFrings)

    -
  • -
- -
- -

- - - Socket 1.12.0 - - - (2022-08-25) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Forward compatibility with react/promise 3.
    -(#214 by @WyriHaximus and @clue)

    -
  • -
  • -

    Feature: Full support for PHP 8.2 release.
    -(#298 by @WyriHaximus)

    -
  • -
  • -

    Feature: Avoid unneeded syscall on socket close.
    -(#292 by @clue)

    -
  • -
  • -

    Feature / Fix: Improve error reporting when custom error handler is used.
    -(#290 by @clue)

    -
  • -
  • -

    Fix: Fix invalid references in exception stack trace.
    -(#284 by @clue)

    -
  • -
  • -

    Minor documentation improvements, update to use new reactphp/async package instead of clue/reactphp-block.
    -(#296 by @clue, #285 by @SimonFrings and #295 by @nhedger)

    -
  • -
  • -

    Improve test suite, update macOS and HHVM environment, fix optional tests for ENETUNREACH.
    -(#288, #289 and #297 by @clue)

    -
  • -
- -
- -

- - - HTTP 1.7.0 - - - (2022-08-23) - - Release on GitHub - - -

- -

This is a SECURITY and feature release for the 1.x series of ReactPHP's HTTP component.

-
    -
  • -

    Security fix: This release fixes a medium severity security issue in ReactPHP's HTTP server component
    -that affects all versions between v0.7.0 and v1.6.0. All users are encouraged to upgrade immediately.
    -Special thanks to Marco Squarcina (TU Wien) for reporting this and working with us to coordinate this release.
    -(CVE-2022-36032 reported by @lavish and fixed by @clue)

    -
  • -
  • -

    Feature: Improve HTTP server performance by ~20%, reuse syscall values for clock time and socket addresses.
    -(#457 and #467 by @clue)

    -
  • -
  • -

    Feature: Full PHP 8.2+ compatibility, refactor internal Transaction to avoid assigning dynamic properties.
    -(#459 by @clue and #466 by @WyriHaximus)

    -
  • -
  • -

    Feature / Fix: Allow explicit Content-Length response header on HEAD requests.
    -(#444 by @mrsimonbennett)

    -
  • -
  • -

    Minor documentation improvements.
    -(#452 by @clue, #458 by @nhedger, #448 by @jorrit and #446 by @SimonFrings)

    -
  • -
  • -

    Improve test suite, update to use new reactphp/async package instead of clue/reactphp-block,
    -skip memory tests when lowering memory limit fails and fix legacy HHVM build.
    -(#464 and #440 by @clue and #450 by @SimonFrings)

    -
  • -
- -
- -

- - - Async 4.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v3.0.0 release. 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:

-
    -
  • -

    Feature / BC break: Require PHP 8.1+ and add mixed type declarations.
    -(#14 by @clue)

    -
  • -
  • -

    Feature: Add Fiber-based async() and await() functions.
    -(#15, #18, #19 and #20 by @WyriHaximus and #26, #28, #30, #32, #34, #55 and #57 by @clue)

    -
  • -
  • -

    Project maintenance, rename main branch to 4.x and update installation instructions.
    -(#29 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v3.0.0 release:

-
    -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#49 by @clue)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#48 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#36 by @SimonFrings and #51 by @nhedger)

    -
  • -
- -
- -

- - - Async 3.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v2.0.0 release. 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:

-
    -
  • -

    Feature / BC break: Require PHP 7.1+ and add type declarations.
    -(#11 by @clue)

    -
  • -
  • -

    Feature: Add Generator-based coroutine() function.
    -(#12, #13 and #54 by @clue)

    -
  • -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#45 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v2.0.0 release:

-
    -
  • -

    Feature: Only stop loop for await() if a pending promise resolves/rejects.
    -(#33 by @SimonFrings)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#47 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#37 by @SimonFrings and #52 by @nhedger)

    -
  • -
- -
- -

- - - Async 2.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

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 v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major changes over the previous v1.0.0 release that
-has been deprecated since 2013. Accordingly, most consumers of this package
-should not be affected by any BC breaks. See below for more details:

-
    -
  • -

    Feature / BC break: Change to Promise-based APIs instead of callbacks (continuation-passing style).
    -Support promise cancellation and upcoming Promise v3.
    -(#6, #7, #9 and #46 by @clue)

    -
  • -
  • -

    Feature: Add new await() function (import from clue/reactphp-block).
    -(#8 by @clue and #39 by @SimonFrings)

    -
  • -
  • -

    Minor documentation improvements.
    -(#38 by @SimonFrings and #53 by @nhedger)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHP 8.1, PHPUnit 9, switch to GitHub actions and clean up test suite.
    -(#2, #3, #4, #5 and #10 by @clue)

    -
  • -
- -
- -

- - - PromiseStream 1.4.0 - - - (2022-06-20) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Forward compatibility with react/promise 3.
    -(#20 by @WyriHaximus)

    -
  • -
  • -

    Improve test suite, test against PHP 8.1 and fix legacy HHVM build.
    -(#28, #29 and #30 by @SimonFrings)

    -
  • -
- -
- -

- - - PromiseTimer 1.9.0 - - - (2022-06-13) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve forward compatibility with upcoming Promise v3 API.
    -(#54 and #55 by @clue)

    -
  • -
  • -

    Minor documentation improvements for upcoming Promise v3.
    -(#58 by @clue and #56 by @SimonFrings)

    -
  • -
  • -

    Improve test suite, fix legacy HHVM build by downgrading Composer.
    -(#57 by @SimonFrings)

    -
  • -
- -
- -

- - - EventLoop 1.3.0 - - - (2022-03-17) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve default StreamSelectLoop to report any warnings for invalid streams.
    -(#245 by @clue)

    -
  • -
  • -

    Feature: Improve performance of StreamSelectLoop when no timers are scheduled.
    -(#246 by @clue)

    -
  • -
  • -

    Fix: Fix periodic timer with zero interval for ExtEvLoop and legacy ExtLibevLoop.
    -(#243 by @lucasnetau)

    -
  • -
  • -

    Minor documentation improvements, update PHP version references.
    -(#240, #248 and #250 by @SimonFrings, #241 by @dbu and #249 by @clue)

    -
  • -
  • -

    Improve test suite and test against PHP 8.1.
    -(#238 by @WyriHaximus and #242 by @clue)

    -
  • -
- -
- -

- - - Promise 2.9.0 - - - (2022-02-11) - - Release on GitHub - - -

- -
    -
  • -

    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)

    -
  • -
- -
- -

- - - HTTP 1.6.0 - - - (2022-02-03) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add factory methods for common HTML/JSON/plaintext/XML response types.
    -(#439 by @clue)

    -
    $response = React\Http\Response\html("<h1>Hello wörld!</h1>\n");
    -$response = React\Http\Response\json(['message' => 'Hello wörld!']);
    -$response = React\Http\Response\plaintext("Hello wörld!\n");
    -$response = React\Http\Response\xml("<message>Hello wörld!</message>\n");
    -
  • -
  • -

    Feature: Expose all status code constants via Response class.
    -(#432 by @clue)

    -
    $response = new React\Http\Message\Response(
    -    React\Http\Message\Response::STATUS_OK, // 200 OK
    -    …
    -);
    -$response = new React\Http\Message\Response(
    -    React\Http\Message\Response::STATUS_NOT_FOUND, // 404 Not Found
    -    …
    -);
    -
  • -
  • -

    Feature: Full support for PHP 8.1 release.
    -(#433 by @SimonFrings and #434 by @clue)

    -
  • -
  • -

    Feature / Fix: Improve protocol handling for HTTP responses with no body.
    -(#429 and #430 by @clue)

    -
  • -
  • -

    Internal refactoring and internal improvements for handling requests and responses.
    -(#422 by @WyriHaximus and #431 by @clue)

    -
  • -
  • -

    Improve documentation, update proxy examples, include error reporting in examples.
    -(#420, #424, #426, and #427 by @clue)

    -
  • -
  • -

    Update test suite to use default loop.
    -(#438 by @clue)

    -
  • -
- -
- -

- - - Socket 1.11.0 - - - (2022-01-14) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full support for PHP 8.1 release.
    -(#277 by @clue)

    -
  • -
  • -

    Feature: Avoid dependency on ext-filter.
    -(#279 by @clue)

    -
  • -
  • -

    Improve test suite to skip FD test when hitting memory limit
    -and skip legacy TLS 1.0 tests if disabled by system.
    -(#278 and #281 by @clue and #283 by @SimonFrings)

    -
  • -
- -
-

- - 2021 -

- - -

- - - DNS 1.9.0 - - - (2021-12-20) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Full support for PHP 8.1 release and prepare PHP 8.2 compatibility
    -by refactoring Parser to avoid assigning dynamic properties.
    -(#188 and #186 by @clue and #184 by @SimonFrings)

    -
  • -
  • -

    Feature: Avoid dependency on ext-filter.
    -(#185 by @clue)

    -
  • -
  • -

    Feature / Fix: Skip invalid nameserver entries from resolv.conf and ignore IPv6 zone IDs.
    -(#187 by @clue)

    -
  • -
  • -

    Feature / Fix: Reduce socket read chunk size for queries over TCP/IP.
    -(#189 by @clue)

    -
  • -
- -
- -

- - - PromiseTimer 1.8.0 - - - (2021-12-06) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new sleep() function and deprecate resolve() and reject() functions.
    -(#51 by @clue)

    -
    // deprecated
    -React\Promise\Timer\resolve($time);
    -React\Promise\Timer\reject($time);
    -
    -// new
    -React\Promise\Timer\sleep($time);
    -
  • -
  • -

    Feature: Support PHP 8.1 release.
    -(#50 by @Thomas-Gelf, #52 by @clue and #48 by @SimonFrings)

    -
  • -
  • -

    Improve API documentation and add parameter types and return types.
    -(#49 by @clue and #47 by @SimonFrings)

    -
  • -
- -
- -

- - - Socket 1.10.0 - - - (2021-11-29) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support listening on existing file descriptors (FDs) with SocketServer.
    -(#269 by @clue)

    -
    $socket = new React\Socket\SocketSever('php://fd/3');
    -

    This is particularly useful when using systemd socket activation like this:

    -
    $ systemd-socket-activate -l 8000 php examples/03-http-server.php php://fd/3
    -
  • -
  • -

    Feature: Improve error messages for failed connection attempts with errno and errstr.
    -(#265, #266, #267, #270 and #271 by @clue and #268 by @SimonFrings)

    -

    All error messages now always include the appropriate errno and errstr to
    -give more details about the error reason when available. Along with these
    -error details exposed by the underlying system functions, it will also
    -include the appropriate error constant name (such as ECONNREFUSED) when
    -available. Accordingly, failed TCP/IP connections will now report the actual
    -underlying error condition instead of a generic "Connection refused" error.
    -Higher-level error messages will now consistently report the connection URI
    -scheme and hostname used in all error messages.

    -

    For most common use cases this means that simply reporting the Exception
    -message should give the most relevant details for any connection issues:

    -
    $connector = new React\Socket\Connector();
    -$connector->connect($uri)->then(function (React\Socket\ConnectionInterface $conn) {
    -    // …
    -}, function (Exception $e) {
    -    echo 'Error:' . $e->getMessage() . PHP_EOL;
    -});
    -
  • -
  • -

    Improve test suite, test against PHP 8.1 release.
    -(#274 by @SimonFrings)

    -
  • -
- -
- -

- - - PromiseStream 1.3.0 - - - (2021-10-18) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve error reporting by appending previous exception messages.
    -(#26 by @clue)

    -

    For most common use cases this means that simply reporting the Exception
    -message should give the most relevant details for any issues:

    -
    React\Promise\Stream\buffer($stream)->then(function (string $contents) {
    -    // …
    -}, function (Exception $e) {
    -    echo 'Error:' . $e->getMessage() . PHP_EOL;
    -});
    -
  • -
  • -

    Improve documentation, describe promise and stream data types.
    -(#27 by @clue and #23 by @WyriHaximus)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Use GitHub actions for continuous integration (CI) and run tests on PHPUnit 9 and PHP 8.
    -(#21 by @reedy and #22, #24 and #25 by @SimonFrings)

    -
  • -
- -
- -

- - - ChildProcess 0.6.4 - - - (2021-10-12) - - Release on GitHub - - -

- -
    -
  • -

    Feature / Fix: Skip sigchild check if phpinfo() has been disabled.
    -(#89 by @clue)

    -
  • -
  • -

    Fix: Fix detecting closed socket pipes on PHP 8.
    -(#90 by @clue)

    -
  • -
- -
- -

- - - HTTP 1.5.0 - - - (2021-08-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Update Browser signature to take optional $connector as first argument and
    -to match new Socket API without nullable loop arguments.
    -(#418 and #419 by @clue)

    -
    // unchanged
    -$browser = new React\Http\Browser();
    -
    -// deprecated
    -$browser = new React\Http\Browser(null, $connector);
    -$browser = new React\Http\Browser($loop, $connector);
    -
    -// new
    -$browser = new React\Http\Browser($connector);
    -$browser = new React\Http\Browser($connector, $loop);
    -
  • -
  • -

    Feature: Rename Server to HttpServer to avoid class name collisions and
    -to avoid any ambiguities with regards to the new SocketServer API.
    -(#417 and #419 by @clue)

    -
    // deprecated
    -$server = new React\Http\Server($handler);
    -$server->listen(new React\Socket\Server(8080));
    -
    -// new
    -$http = new React\Http\HttpServer($handler);
    -$http->listen(new React\Socket\SocketServer('127.0.0.1:8080'));
    -
  • -
- -
- -

- - - Socket 1.9.0 - - - (2021-08-03) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new SocketServer and deprecate Server to avoid class name collisions.
    -(#263 by @clue)

    -

    The new SocketServer class has been added with an improved constructor signature
    -as a replacement for the previous Server class in order to avoid any ambiguities.
    -The previous name has been deprecated and should not be used anymore.
    -In its most basic form, the deprecated Server can now be considered an alias for new SocketServer.

    -
    // deprecated
    -$socket = new React\Socket\Server(0);
    -$socket = new React\Socket\Server('127.0.0.1:8000');
    -$socket = new React\Socket\Server('127.0.0.1:8000', null, $context);
    -$socket = new React\Socket\Server('127.0.0.1:8000', $loop, $context);
    -
    -// new
    -$socket = new React\Socket\SocketServer('127.0.0.1:0');
    -$socket = new React\Socket\SocketServer('127.0.0.1:8000');
    -$socket = new React\Socket\SocketServer('127.0.0.1:8000', $context);
    -$socket = new React\Socket\SocketServer('127.0.0.1:8000', $context, $loop);
    -
  • -
  • -

    Feature: Update Connector signature to take optional $context as first argument.
    -(#264 by @clue)

    -

    The new signature has been added to match the new SocketServer and
    -consistently move the now commonly unneeded loop argument to the last argument.
    -The previous signature has been deprecated and should not be used anymore.
    -In its most basic form, both signatures are compatible.

    -
     // deprecated
    -$connector = new React\Socket\Connector(null, $context);
    -$connector = new React\Socket\Connector($loop, $context);
    -
    -// new
    -$connector = new React\Socket\Connector($context);
    -$connector = new React\Socket\Connector($context, $loop);
    -
  • -
- -
- -

- - - PromiseTimer 1.7.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#46 by @clue)

    -
    // old (still supported)
    -$promise = timeout($promise, $time, $loop);
    -$promise = resolve($time, $loop);
    -$promise = reject($time, $loop);
    -
    -// new (using default loop)
    -$promise = timeout($promise, $time);
    -$promise = resolve($time);
    -$promise = reject($time);
    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI),
    -update PHPUnit config, run tests on PHP 8 and add full core team to the license.
    -(#43 by @WyriHaximus, #44 and #45 by @SimonFrings)

    -
  • -
- -
- -

- - - Datagram 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#42 by @clue)

    -
    // old (still supported)
    -$factory = new React\Datagram\Factory($loop);
    -
    -// new (using default loop)
    -$factory = new React\Datagram\Factory();
    -
  • -
- -
- -

- - - ChildProcess 0.6.3 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#87 by @clue)

    -
    // old (still supported)
    -$process = new React\ChildProcess\Process($command);
    -$process->start($loop);
    -
    -// new (using default loop)
    -$process = new React\ChildProcess\Process($command);
    -$process->start();
    -
  • -
- -
- -

- - - HTTP 1.4.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#410 by @clue)

    -
    // old (still supported)
    -$browser = new React\Http\Browser($loop);
    -$server = new React\Http\Server($loop, $handler);
    -
    -// new (using default loop)
    -$browser = new React\Http\Browser();
    -$server = new React\Http\Server($handler);
    -
  • -
- -
- -

- - - Socket 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#260 by @clue)

    -
    // old (still supported)
    -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
    -$connector = new React\Socket\Connector($loop);
    -
    -// new (using default loop)
    -$socket = new React\Socket\Server('127.0.0.1:8080');
    -$connector = new React\Socket\Connector();
    -
  • -
- -
- -

- - - DNS 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#182 by @clue)

    -
    // old (still supported)
    -$factory = new React\Dns\Resolver\Factory();
    -$resolver = $factory->create($config, $loop);
    -
    -// new (using default loop)
    -$factory = new React\Dns\Resolver\Factory();
    -$resolver = $factory->create($config);
    -
  • -
- -
- -

- - - Stream 1.2.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Simplify usage by supporting new default loop.
    -(#159 by @clue)

    -
    // old (still supported)
    -$stream = new ReadableResourceStream($resource, $loop);
    -$stream = new WritabeResourceStream($resource, $loop);
    -$stream = new DuplexResourceStream($resource, $loop);
    -
    -// new (using default loop)
    -$stream = new ReadableResourceStream($resource);
    -$stream = new WritabeResourceStream($resource);
    -$stream = new DuplexResourceStream($resource);
    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI),
    -update PHPUnit config, run tests on PHP 8 and add full core team to the license.
    -(#153, #156 and #157 by @SimonFrings and #154 by @WyriHaximus)

    -
  • -
- -
- -

- - - EventLoop 1.2.0 - - - (2021-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Introduce new concept of default loop with the new Loop class.
    -(#226 by @WyriHaximus, #229, #231 and #232 by @clue)

    -

    The Loop class exists as a convenient global accessor for the event loop.
    -It provides all methods that exist on the LoopInterface as static methods and
    -will automatically execute the loop at the end of the program:

    -
    $timer = Loop::addPeriodicTimer(0.1, function () {
    -    echo 'Tick' . PHP_EOL;
    -});
    -
    -Loop::addTimer(1.0, function () use ($timer) {
    -    Loop::cancelTimer($timer);
    -    echo 'Done' . PHP_EOL;
    -});
    -

    The explicit loop instructions are still valid and may still be useful in some applications,
    -especially for a transition period towards the more concise style.
    -The Loop::get() method can be used to get the currently active event loop instance.

    -
    // deprecated
    -$loop = React\EventLoop\Factory::create();
    -
    -// new
    -$loop = React\EventLoop\Loop::get();
    -
  • -
  • -

    Minor documentation improvements and mark legacy extensions as deprecated.
    -(#234 by @SimonFrings, #214 by @WyriHaximus and #233 and #235 by @nhedger)

    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI),
    -update PHPUnit config and run tests on PHP 8.
    -(#212 and #215 by @SimonFrings and #230 by @clue)

    -
  • -
- -
- -

- - - Datagram 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support falling back to multiple DNS servers from DNS config.
    -(#41 by @clue)

    -

    When using the Factory, it will now use all DNS servers configured on your
    -system. If you have multiple DNS servers configured and connectivity to the
    -primary DNS server is broken, it will now fall back to your other DNS
    -servers, thus providing improved connectivity and redundancy for broken DNS
    -configurations.

    -
  • -
- -
- -

- - - Socket 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support falling back to multiple DNS servers from DNS config.
    -(#257 by @clue)

    -

    If you're using the default Connector, it will now use all DNS servers
    -configured on your system. If you have multiple DNS servers configured and
    -connectivity to the primary DNS server is broken, it will now fall back to
    -your other DNS servers, thus providing improved connectivity and redundancy
    -for broken DNS configurations.

    -
  • -
  • -

    Feature: Use round robin for happy eyeballs DNS responses (load balancing).
    -(#247 by @clue)

    -

    If you're using the default Connector, it will now randomize the order of
    -the IP addresses resolved via DNS when connecting. This allows the load to
    -be distributed more evenly across all returned IP addresses. This can be
    -used as a very basic DNS load balancing mechanism.

    -
  • -
  • -

    Internal improvement to avoid unhandled rejection for future Promise API.
    -(#258 by @clue)

    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI).
    -(#254 by @SimonFrings)

    -
  • -
- -
- -

- - - DNS 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Update DNS Factory to accept complete Config object.
    -Add new FallbackExecutor and use fallback DNS servers when Config lists multiple servers.
    -(#179 and #180 by @clue)

    -
    // old (still supported)
    -$config = React\Dns\Config\Config::loadSystemConfigBlocking();
    -$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
    -$resolver = $factory->create($server, $loop);
    -
    -// new
    -$config = React\Dns\Config\Config::loadSystemConfigBlocking();
    -if (!$config->nameservers) {
    -    $config->nameservers[] = '8.8.8.8';
    -}
    -$resolver = $factory->create($config, $loop);
    -
  • -
- -
- -

- - - DNS 1.6.0 - - - (2021-06-21) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add support for legacy SPF record type.
    -(#178 by @akondas and @clue)

    -
  • -
  • -

    Fix: Fix integer overflow for TCP/IP chunk size on 32 bit platforms.
    -(#177 by @clue)

    -
  • -
- -
- -

- - - HTTP 1.3.0 - - - (2021-04-11) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support persistent connections (Connection: keep-alive).
    -(#405 by @clue)

    -

    This shows a noticeable performance improvement especially when benchmarking
    -using persistent connections (which is the default pretty much everywhere).
    -Together with other changes in this release, this improves benchmarking
    -performance by around 100%.

    -
  • -
  • -

    Feature: Require Host request header for HTTP/1.1 requests.
    -(#404 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#398 by @fritz-gerneth and #399 and #400 by @pavog)

    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI).
    -(#402 by @SimonFrings)

    -
  • -
- -
- -

- - - HttpClient 0.5.11 - - - (2021-04-07) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Minimal fix for PHP 8
    -(#154 by @remicollet)

    -
  • -
  • -

    Documentation: Add deprecation notice to suggest HTTP component instead
    -(#153 by @clue)

    -
  • -
- -
- -

- - - DNS 1.5.0 - - - (2021-03-05) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve error reporting when query fails, include domain and query type and DNS server address where applicable.
    -(#174 by @clue)

    -
  • -
  • -

    Feature: Improve error handling when sending data to DNS server fails (macOS).
    -(#171 and #172 by @clue)

    -
  • -
  • -

    Fix: Improve DNS response parser to limit recursion for compressed labels.
    -(#169 by @clue)

    -
  • -
  • -

    Improve test suite, use GitHub actions for continuous integration (CI).
    -(#170 by @SimonFrings)

    -
  • -
- -
- -

- - - Datagram 1.6.0 - - - (2021-02-12) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support PHP 8 (socket address of closed socket should be null).
    -(#39 by @clue)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHPUnit 9, switch to GitHub actions and clean up test suite.
    -(#30, #31 and #38 by @clue, #34 by @reedy, #35 by @WyriHaximus and #37 by @SimonFrings)

    -
  • -
- -
- -

- - - ChildProcess 0.6.2 - - - (2021-02-05) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support PHP 8 and add non-blocking I/O support on Windows with PHP 8.
    -(#85 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#78 by @WyriHaximus and #80 by @gdejong)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHPUnit 9, switch to GitHub actions and clean up test suite.
    -(#75 by @reedy, #81 by @gdejong, #82 by @SimonFrings and #84 by @clue)

    -
  • -
- -
- -

- - - Cache 1.1.1 - - - (2021-02-02) - - Release on GitHub - - -

- -
    -
  • Documentation: Align DocBlock Promise return types
    -(#44 by @WyriHaximus)
  • -
- -
-

- - 2020 -

- - -

- - - HTTP 1.2.0 - - - (2020-12-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Keep request body in memory also after consuming request body.
    -(#395 by @clue)

    -

    This means consumers can now always access the complete request body as
    -detailed in the documentation. This allows building custom parsers and more
    -advanced processing models without having to mess with the default parsers.

    -
  • -
- -
- -

- - - DNS 1.4.0 - - - (2020-09-18) - - Release on GitHub - - -

- - - -
- -

- - - Cache 1.1.0 - - - (2020-09-18) - - Release on GitHub - - -

- - - -
- -

- - - HTTP 1.1.0 - - - (2020-09-11) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support upcoming PHP 8 release, update to reactphp/socket v1.6 and adjust type checks for invalid chunk headers.
    -(#391 by @clue)

    -
  • -
  • -

    Feature: Consistently resolve base URL according to HTTP specs.
    -(#379 by @clue)

    -
  • -
  • -

    Feature / Fix: Expose Transfer-Encoding: chunked response header and fix chunked responses for HEAD requests.
    -(#381 by @clue)

    -
  • -
  • -

    Internal refactoring to remove unneeded MessageFactory and Response classes.
    -(#380 and #389 by @clue)

    -
  • -
  • -

    Minor documentation improvements and improve test suite, update to support PHPUnit 9.3.
    -(#385 by @clue and #393 by @SimonFrings)

    -
  • -
- -
- -

- - - Socket 1.6.0 - - - (2020-08-28) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support upcoming PHP 8 release.
    -(#246 by @clue)

    -
  • -
  • -

    Feature: Change default socket backlog size to 511.
    -(#242 by @clue)

    -
  • -
  • -

    Fix: Fix closing connection when cancelling during TLS handshake.
    -(#241 by @clue)

    -
  • -
  • -

    Fix: Fix blocking during possible accept() race condition
    -when multiple socket servers listen on same socket address.
    -(#244 by @clue)

    -
  • -
  • -

    Improve test suite, update PHPUnit config and add full core team to the license.
    -(#243 by @SimonFrings and #245 by @WyriHaximus)

    -
  • -
- -
- -

- - - HTTP 1.0.0 - - - (2020-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • First stable LTS release, now following SemVer.
    -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.
  • -
-

This update involves some major new features and a number of BC breaks due to
-some necessary API cleanup. 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:

-
    -
  • -

    Feature: Add async HTTP client implementation.
    -(#368 by @clue)

    -
    $browser = new React\Http\Browser($loop);
    -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
    -    echo $response->getBody();
    -});
    -

    The code has been imported as-is from clue/reactphp-buzz v2.9.0,
    -with only minor changes to the namespace and we otherwise leave all the existing APIs unchanged.
    -Upgrading from clue/reactphp-buzz v2.9.0
    -to this release should be a matter of updating some namespace references only:

    -
    // old
    -$browser = new Clue\React\Buzz\Browser($loop);
    -
    -// new
    -$browser = new React\Http\Browser($loop);
    -
  • -
  • -

    Feature / BC break: Add LoopInterface as required first constructor argument to Server and
    -change Server to accept variadic middleware handlers instead of array.
    -(#361 and #362 by @WyriHaximus)

    -
    // old
    -$server = new React\Http\Server($handler);
    -$server = new React\Http\Server([$middleware, $handler]);
    -
    -// new
    -$server = new React\Http\Server($loop, $handler);
    -$server = new React\Http\Server($loop, $middleware, $handler);
    -
  • -
  • -

    Feature / BC break: Move Response class to React\Http\Message\Response and
    -expose ServerRequest class to React\Http\Message\ServerRequest.
    -(#370 by @clue)

    -
    // old
    -$response = new React\Http\Response(200, [], 'Hello!');
    -
    -// new
    -$response = new React\Http\Message\Response(200, [], 'Hello!');
    -
  • -
  • -

    Feature / BC break: Add StreamingRequestMiddleware to stream incoming requests, mark StreamingServer as internal.
    -(#367 by @clue)

    -
    // old: advanced StreamingServer is now internal only
    -$server = new React\Http\StreamingServer($handler);
    -
    -// new: use StreamingRequestMiddleware instead of StreamingServer
    -$server = new React\Http\Server(
    -     $loop,
    -     new React\Http\Middleware\StreamingRequestMiddleware(),
    -     $handler
    -);
    -
  • -
  • -

    Feature / BC break: Improve default concurrency to 1024 requests and cap default request buffer at 64K.
    -(#371 by @clue)

    -

    This improves default concurrency to 1024 requests and caps the default request buffer at 64K.
    -The previous defaults resulted in just 4 concurrent requests with a request buffer of 8M.
    -See Server for details on how to override these defaults.

    -
  • -
  • -

    Feature: Expose ReactPHP in User-Agent client-side request header and in Server server-side response header.
    -(#374 by @clue)

    -
  • -
  • -

    Mark all classes as final to discourage inheriting from it.
    -(#373 by @WyriHaximus)

    -
  • -
  • -

    Improve documentation and use fully-qualified class names throughout the documentation and
    -add ReactPHP core team as authors to composer.json and license file.
    -(#366 and #369 by @WyriHaximus and #375 by @clue)

    -
  • -
  • -

    Improve test suite and support skipping all online tests with --exclude-group internet.
    -(#372 by @clue)

    -
  • -
- -
- -

- - - PromiseTimer 1.6.0 - - - (2020-07-10) - - Release on GitHub - - -

- - - -
- -

- - - DNS 1.3.0 - - - (2020-07-10) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Forward compatibility with react/promise v3.
    -(#153 by @WyriHaximus)

    -
  • -
  • -

    Feature: Support parsing OPT records (EDNS0).
    -(#157 by @clue)

    -
  • -
  • -

    Fix: Avoid PHP warnings due to lack of args in exception trace on PHP 7.4.
    -(#160 by @clue)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHPUnit 9 and PHP 7.4 and clean up test suite.
    -(#154 by @reedy, #156 by @clue and #163 by @SimonFrings)

    -
  • -
- -
- -

- - - HTTP 0.8.7 - - - (2020-07-05) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Fix parsing multipart request body with quoted header parameters (dot net).
    -(#363 by @ebimmel)

    -
  • -
  • -

    Fix: Fix calculating concurrency when post_max_size ini is unlimited.
    -(#365 by @clue)

    -
  • -
  • -

    Improve test suite to run tests on PHPUnit 9 and clean up test suite.
    -(#364 by @SimonFrings)

    -
  • -
- -
- -

- - - Socket 1.5.0 - - - (2020-07-01) - - Release on GitHub - - -

- -
    -
  • -

    Feature / Fix: Improve error handling and reporting for happy eyeballs and
    -immediately try next connection when one connection attempt fails.
    -(#230, #231, #232 and #233 by @clue)

    -

    Error messages for failed connection attempts now include more details to
    -ease debugging. Additionally, the happy eyeballs algorithm has been improved
    -to avoid having to wait for some timers to expire which significantly
    -improves connection setup times (in particular when IPv6 isn't available).

    -
  • -
  • -

    Improve test suite, minor code cleanup and improve code coverage to 100%.
    -Update to PHPUnit 9 and skip legacy TLS 1.0 / TLS 1.1 tests if disabled by
    -system. Run tests on Windows and simplify Travis CI test matrix for Mac OS X
    -setup and skip all TLS tests on legacy HHVM.
    -(#229, #235, #236 and #238 by @clue and #239 by @SimonFrings)

    -
  • -
- -
- -

- - - Promise 2.8.0 - - - (2020-05-12) - - Release on GitHub - - -

- -
    -
  • -

    Mark FulfilledPromise, RejectedPromise and LazyPromise as 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 .gitattributes to 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)

    -
  • -
- -
- -

- - - Stream 1.1.1 - - - (2020-05-04) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Fix faulty write buffer behavior when sending large data chunks over TLS (Mac OS X only).
    -(#150 by @clue)

    -
  • -
  • -

    Minor code style improvements to fix phpstan analysis warnings and
    -add .gitattributes to exclude dev files from exports.
    -(#140 by @flow-control and #144 by @reedy)

    -
  • -
  • -

    Improve test suite to run tests on PHP 7.4 and simplify test matrix.
    -(#147 by @clue)

    -
  • -
- -
- -

- - - Socket 1.4.0 - - - (2020-03-12) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    Feature: Add IPv6 support to Connector (implement "Happy Eyeballs" algorithm to support IPv6 probing).
    -IPv6 support is turned on by default, use new happy_eyeballs option in Connector to toggle behavior.
    -(#196, #224 and #225 by @WyriHaximus and @clue)

    -
  • -
  • -

    Feature: Default to using DNS cache (with max 256 entries) for Connector.
    -(#226 by @clue)

    -
  • -
  • -

    Add .gitattributes to exclude dev files from exports and some minor code style fixes.
    -(#219 by @reedy and #218 by @mmoreram)

    -
  • -
  • -

    Improve test suite to fix failing test cases when using new DNS component,
    -significantly improve test performance by awaiting events instead of sleeping,
    -exclude TLS 1.3 test on PHP 7.3, run tests on PHP 7.4 and simplify test matrix.
    -(#208, #209, #210, #217 and #223 by @clue)

    -
  • -
- -
- -

- - - HttpClient 0.5.10 - - - (2020-01-14) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Avoid unneeded warning when decoding invalid data on PHP 7.4.
    -(#150 by @clue)

    -
  • -
  • -

    Add .gitattributes to exclude dev files from exports.
    -(#149 by @reedy)

    -
  • -
  • -

    Link to clue/reactphp-buzz for higher-level HTTP client.
    -(#139 by @clue)

    -
  • -
  • -

    Improve test suite by simplifying test matrix and test setup.
    -(#151 by @clue)

    -
  • -
- -
- -

- - - HTTP 0.8.6 - - - (2020-01-12) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Fix parsing Cookie request header with comma in its values.
    -(#352 by @Fiskie)

    -
  • -
  • -

    Fix: Avoid unneeded warning when decoding invalid data on PHP 7.4.
    -(#357 by @WyriHaximus)

    -
  • -
  • -

    Add .gitattributes to exclude dev files from exports.
    -(#353 by @reedy)

    -
  • -
- -
- -

- - - EventLoop 1.1.1 - - - (2020-01-01) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Fix reporting connection refused errors with ExtUvLoop on Linux and StreamSelectLoop on Windows.
    -(#207 and #208 by @clue)

    -
  • -
  • -

    Fix: Fix unsupported EventConfig and SEGFAULT on shutdown with ExtEventLoop on Windows.
    -(#205 by @clue)

    -
  • -
  • -

    Fix: Prevent interval overflow for timers very far in the future with ExtUvLoop.
    -(#196 by @PabloKowalczyk)

    -
  • -
  • -

    Fix: Check PCNTL functions for signal support instead of PCNTL extension with StreamSelectLoop.
    -(#195 by @clue)

    -
  • -
  • -

    Add .gitattributes to exclude dev files from exports.
    -(#201 by @reedy)

    -
  • -
  • -

    Improve test suite to fix testing ExtUvLoop on Travis,
    -fix Travis CI builds, do not install libuv on legacy PHP setups,
    -fix failing test cases due to inaccurate timers,
    -run tests on Windows via Travis CI and
    -run tests on PHP 7.4 and simplify test matrix and test setup.
    -(#197 by @WyriHaximus and #202, #203, #204 and #209 by @clue)

    -
  • -
- -
-

- - 2019 -

- - -

- - - HTTP 0.8.5 - - - (2019-10-29) - - Release on GitHub - - -

- -
    -
  • -

    Internal refactorings and optimizations to improve request parsing performance.
    -Benchmarks suggest number of requests/s improved by ~30% for common GET requests.
    -(#345, #346, #349 and #350 by @clue)

    -
  • -
  • -

    Add documentation and example for JSON/XML request body and
    -improve documentation for concurrency and streaming requests and for error handling.
    -(#341 and #342 by @clue)

    -
  • -
- -
- -

- - - DNS 1.2.0 - - - (2019-08-15) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add TcpTransportExecutor to send DNS queries over TCP/IP connection,
    -add SelectiveTransportExecutor to retry with TCP if UDP is truncated and
    -automatically select transport protocol when no explicit udp:// or tcp:// scheme is given in Factory.
    -(#145, #146, #147 and #148 by @clue)

    -
  • -
  • -

    Feature: Support escaping literal dots and special characters in domain names.
    -(#144 by @clue)

    -
  • -
- -
- -

- - - DNS 1.1.0 - - - (2019-07-18) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support parsing CAA and SSHFP records.
    -(#141 and #142 by @clue)

    -
  • -
  • -

    Feature: Add ResolverInterface as common interface for Resolver class.
    -(#139 by @clue)

    -
  • -
  • -

    Fix: Add missing private property definitions and
    -remove unneeded dependency on react/stream.
    -(#140 and #143 by @clue)

    -
  • -
- -
- -

- - - DNS 1.0.0 - - - (2019-07-11) - - Release on GitHub - - -

- -
    -
  • First stable LTS release, now following SemVer.
    -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.
  • -
-

This update involves a number of BC breaks due to dropped support for
-deprecated functionality and some internal API cleanup. We've tried hard to
-avoid BC breaks where possible and minimize impact otherwise. We expect that
-most consumers of this package will actually not be affected by any BC
-breaks, see below for more details:

-
    -
  • -

    BC break: Delete all deprecated APIs, use Query objects for Message questions
    -instead of nested arrays and increase code coverage to 100%.
    -(#130 by @clue)

    -
  • -
  • -

    BC break: Move $nameserver from ExecutorInterface to UdpTransportExecutor,
    -remove advanced/internal UdpTransportExecutor args for Parser/BinaryDumper and
    -add API documentation for ExecutorInterface.
    -(#135, #137 and #138 by @clue)

    -
  • -
  • -

    BC break: Replace HeaderBag attributes with simple Message properties.
    -(#132 by @clue)

    -
  • -
  • -

    BC break: Mark all Record attributes as required, add documentation vs Query.
    -(#136 by @clue)

    -
  • -
  • -

    BC break: Mark all classes as final to discourage inheritance
    -(#134 by @WyriHaximus)

    -
  • -
- -
- -

- - - Cache 1.0.0 - - - (2019-07-11) - - Release on GitHub - - -

- -
    -
  • First stable LTS release, now following SemVer.
    -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.
  • -
-
-

Contains no other changes, so it's actually fully compatible with the v0.6.0 release.

-
- -
- -

- - - DNS 0.4.19 - - - (2019-07-10) - - Release on GitHub - - -

- -
    -
  • Feature: Avoid garbage references when DNS resolution rejects on legacy PHP <= 5.6.
    -(#133 by @clue)
  • -
- -
- -

- - - Socket 1.3.0 - - - (2019-07-10) - - Release on GitHub - - -

- -
    -
  • Feature: Forward compatibility with upcoming stable DNS component.
    -(#206 by @clue)
  • -
- -
- -

- - - Datagram 1.5.0 - - - (2019-07-10) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Forward compatibility with upcoming stable DNS component.
    -(#29 by @clue)

    -
  • -
  • -

    Prefix all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
    -(#28 by @WyriHaximus)

    -
  • -
  • -

    Improve test suite to also test against PHP 7.1 and 7.2.
    -(#25 by @andreybolonin)

    -
  • -
- -
- -

- - - DNS 0.4.18 - - - (2019-07-09) - - Release on GitHub - - -

- -
    -
  • -

    Feature / Fix: Implement CachingExecutor using cache TTL, deprecate old CachedExecutor,
    -respect TTL from response records when caching and do not cache truncated responses.
    -(#129 by @clue)

    -
  • -
  • -

    Feature: Limit cache size to 256 last responses by default.
    -(#127 by @clue)

    -
  • -
  • -

    Feature: Cooperatively resolve hosts to avoid running same query concurrently.
    -(#125 by @clue)

    -
  • -
- -
- -

- - - Cache 0.6.0 - - - (2019-07-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature / BC break: Add support for getMultiple(), setMultiple(), deleteMultiple(), clear() and has()
    -supporting multiple cache items (inspired by PSR-16).
    -(#32 by @krlv and #37 by @clue)

    -
  • -
  • -

    Documentation for TTL precision with millisecond accuracy or below and
    -use high-resolution timer for cache TTL on PHP 7.3+.
    -(#35 and #38 by @clue)

    -
  • -
  • -

    Improve API documentation and allow legacy HHVM to fail in Travis CI config.
    -(#34 and #36 by @clue)

    -
  • -
  • -

    Prefix all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
    -(#31 by @WyriHaximus)

    -
  • -
- -
- -

- - - PromiseStream 1.2.0 - - - (2019-07-03) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support unwrapping object streams by buffering original write chunks in array.
    -(#15 by @clue)

    -
  • -
  • -

    Feature: Clean up unneeded references for unwrapped streams when closing.
    -(#18 by @clue)

    -
  • -
  • -

    Fix: Writing to closed unwrapped stream should return false (backpressure).
    -(#17 by @clue)

    -
  • -
  • -

    Improve test suite to support PHPUnit 7, PHP 7.3 and fix incomplete test
    -and improve API documentation.
    -(#16 and #19 by @clue)

    -
  • -
- -
- -

- - - Socket 1.2.1 - - - (2019-06-03) - - Release on GitHub - - -

- -
    -
  • -

    Avoid uneeded fragmented TLS work around for PHP 7.3.3+ and
    -work around failing test case detecting EOF on TLS 1.3 socket streams.
    -(#201 and #202 by @clue)

    -
  • -
  • -

    Improve TLS certificate/passphrase example.
    -(#190 by @jsor)

    -
  • -
- -
- -

- - - DNS 0.4.17 - - - (2019-04-01) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Support parsing authority and additional records from DNS response.
    -(#123 by @clue)

    -
  • -
  • -

    Feature: Support dumping records as part of outgoing binary DNS message.
    -(#124 by @clue)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Cache v0.6 and Cache v1.0
    -(#121 by @clue)

    -
  • -
  • -

    Improve test suite to add forward compatibility with PHPUnit 7,
    -test against PHP 7.3 and use legacy PHPUnit 5 on legacy HHVM.
    -(#122 by @clue)

    -
  • -
- -
- -

- - - PromiseTimer 1.5.1 - - - (2019-03-27) - - Release on GitHub - - -

- -
    -
  • -

    Fix: Typo in readme
    -(#35 by @aak74)

    -
  • -
  • -

    Improvement: Only include functions file when functions aren't defined
    -(#36 by @Niko9911)

    -
  • -
- -
- -

- - - ChildProcess 0.6.1 - - - (2019-02-15) - - Release on GitHub - - -

- -
    -
  • Feature / Fix: Improve error reporting when spawning child process fails.
    -(#73 by @clue)
  • -
- -
- -

- - - EventLoop 1.1.0 - - - (2019-02-07) - - Release on GitHub - - -

- -
    -
  • -

    New UV based event loop (ext-uv).
    -(#112 by @WyriHaximus)

    -
  • -
  • -

    Use high resolution timer on PHP 7.3+.
    -(#182 by @clue)

    -
  • -
  • -

    Improve PCNTL signals by using async signal dispatching if available.
    -(#179 by @CharlotteDunois)

    -
  • -
  • -

    Improve test suite and test suite set up.
    -(#174 by @WyriHaximus, #181 by @clue)

    -
  • -
  • -

    Fix PCNTL signals edge case.
    -(#183 by @clue)

    -
  • -
- -
- -

- - - HTTP 0.8.4 - - - (2019-01-16) - - Release on GitHub - - -

- -
    -
  • -

    Improvement: Internal refactoring to simplify response header logic.
    -(#321 by @clue)

    -
  • -
  • -

    Improvement: Assign Content-Length response header automatically only when size is known.
    -(#329 by @clue)

    -
  • -
  • -

    Improvement: Import global functions for better performance.
    -(#330 by @WyriHaximus)

    -
  • -
- -
- -

- - - ChildProcess 0.6.0 - - - (2019-01-14) - - Release on GitHub - - -

- -

A major feature release with some minor API improvements!
-This project now has limited Windows support and supports passing custom pipes
-and file descriptors to the child process.

-

This update involves a few minor BC breaks. We've tried hard to avoid BC breaks
-where possible and minimize impact otherwise. We expect that most consumers of
-this package will actually not be affected by any BC breaks, see below for more
-details.

-
    -
  • -

    Feature / BC break: Support passing custom pipes and file descriptors to child process,
    -expose all standard I/O pipes in an array and remove unused Windows-only options.
    -(#62, #64 and #65 by @clue)

    -
    -

    BC note: The optional $options parameter in the Process constructor
    -has been removed and a new $fds parameter has been added instead. The
    -previous $options parameter was Windows-only, available options were not
    -documented or referenced anywhere else in this library, so its actual
    -impact is expected to be relatively small. See the documentation and the
    -following changelog entry if you're looking for Windows support.

    -
    -
  • -
  • -

    Feature: Support spawning child process on Windows without process I/O pipes.
    -(#67 by @clue)

    -
  • -
  • -

    Feature / BC break: Improve sigchild compatibility and support explicit configuration.
    -(#63 by @clue)

    -
    // advanced: not recommended by default
    -Process::setSigchildEnabled(true);
    -
    -

    BC note: The old public sigchild methods have been removed, but its
    -practical impact is believed to be relatively small due to the automatic detection.

    -
    -
  • -
  • -

    Improve performance by prefixing all global functions calls with \ to skip
    -the look up and resolve process and go straight to the global function.
    -(#68 by @WyriHaximus)

    -
  • -
  • -

    Minor documentation improvements and docblock updates.
    -(#59 by @iamluc and #69 by @CharlotteDunois)

    -
  • -
  • -

    Improve test suite to test against PHP7.2 and PHP 7.3, improve HHVM compatibility,
    -add forward compatibility with PHPUnit 7 and run tests on Windows via Travis CI.
    -(#66 and #71 by @clue)

    -
  • -
- -
- -

- - - Promise 2.7.1 - - - (2019-01-07) - - Release on GitHub - - -

- -
    -
  • 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)
  • -
- -
- -

- - - Socket 1.2.0 - - - (2019-01-07) - - Release on GitHub - - -

- -
    -
  • -

    Feature / Fix: Improve TLS 1.3 support.
    -(#186 by @clue)

    -

    TLS 1.3 is now an official standard as of August 2018! 🎉
    -The protocol has major improvements in the areas of security, performance, and privacy.
    -TLS 1.3 is supported by default as of OpenSSL 1.1.1.
    -For example, this version ships with Ubuntu 18.10 (and newer) by default, meaning that recent installations support TLS 1.3 out of the box :shipit:

    -
  • -
  • -

    Fix: Avoid possibility of missing remote address when TLS handshake fails.
    -(#188 by @clue)

    -
  • -
  • -

    Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
    -(#183 by @WyriHaximus)

    -
  • -
  • -

    Update documentation to use full class names with namespaces.
    -(#187 by @clue)

    -
  • -
  • -

    Improve test suite to avoid some possible race conditions,
    -test against PHP 7.3 on Travis and
    -use dedicated assertInstanceOf() assertions.
    -(#185 by @clue, #178 by @WyriHaximus and #181 by @carusogabriel)

    -
  • -
- -
- -

- - - Stream 1.1.0 - - - (2019-01-01) - - Release on GitHub - - -

- - - -
-

- - 2018 -

- - -

- - - DNS 0.4.16 - - - (2018-11-11) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve promise cancellation for DNS lookup retries and clean up any garbage references.
    -(#118 by @clue)

    -
  • -
  • -

    Fix: Reject parsing malformed DNS response messages such as incomplete DNS response messages,
    -malformed record data or malformed compressed domain name labels.
    -(#115 and #117 by @clue)

    -
  • -
  • -

    Fix: Fix interpretation of TTL as UINT32 with most significant bit unset.
    -(#116 by @clue)

    -
  • -
  • -

    Fix: Fix caching advanced MX/SRV/TXT/SOA structures.
    -(#112 by @clue)

    -
  • -
- -
- -

- - - Socket 1.1.0 - - - (2018-10-01) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve error reporting for failed connection attempts and improve
    -cancellation forwarding during DNS lookup, TCP/IP connection or TLS handshake.
    -(#168, #169, #170, #171, #176 and #177 by @clue)

    -

    All error messages now always contain a reference to the remote URI to give
    -more details which connection actually failed and the reason for this error.
    -Accordingly, failures during DNS lookup will now mention both the remote URI
    -as well as the DNS error reason. TCP/IP connection issues and errors during
    -a secure TLS handshake will both mention the remote URI as well as the
    -underlying socket error. Similarly, lost/dropped connections during a TLS
    -handshake will now report a lost connection instead of an empty error reason.

    -

    For most common use cases this means that simply reporting the Exception
    -message should give the most relevant details for any connection issues:

    -
    $promise = $connector->connect('tls://example.com:443');
    -$promise->then(function (ConnectionInterface $conn) use ($loop) {
    -    // …
    -}, function (Exception $e) {
    -    echo $e->getMessage();
    -});
    -
  • -
- -
- -

- - - Socket 1.0.0 - - - (2018-07-11) - - Release on GitHub - - -

- -
    -
  • First stable LTS release, now following SemVer.
    -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.
  • -
-
-

Contains no other changes, so it's actually fully compatible with the v0.8.12 release.

-
- -
- -

- - - Stream 1.0.0 - - - (2018-07-11) - - Release on GitHub - - -

- -
    -
  • First stable LTS release, now following SemVer.
    -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.
  • -
-
-

Contains no other changes, so it's actually fully compatible with the v0.7.7 release.

-
- -
- -

- - - EventLoop 1.0.0 - - - (2018-07-11) - - Release on GitHub - - -

+ +
+ +
+ + -

- + +
+
+

+Changelog

+

The combined changelog for all ReactPHP components.

- Cache 0.5.0 - - (2018-06-25) - - Release on GitHub - - -

+ - +

+ + 2018 +

-

@@ -4702,9 +235,9 @@

-