rx/react-promise

This package is abandoned and no longer maintained. No replacement package was suggested.

RxPHP v2 support for ReactPHP's Promises

0.0.2 2017-03-07 00:08 UTC

This package is auto-updated.

Last update: 2020-05-05 14:16:25 UTC


README

This project is superseded by the promise support in the current version of RxPHP v2.

Since the interop promise spec hasn't been adopted by any of the popular async php project, we've reverted back to defaulting to React promises in RxPHP v2.

Provides RxPHP 2 support for ReactPHP's Promises

RxPHP v2 will only support async-interop promises by default. This project restores the ReactPHP Promise support found in RxPHP v1.

Usage

From Observable

    
  $observable = \Rx\Observable::of(42);
  $promise = \Rx\React\Promise::fromObservable($observable);
  
  $promise->then(function ($value) {
      echo "Value {$value}\n";
  });
    

To Observable

    
  $promise = \Rx\React\Promise::resolved(42);
  $observable = \Rx\React\Promise::toObservable($promise);
  
  $observable->subscribe(function ($value) {
      echo "Value {$value}\n";
  });