PHP code example of tickner / guzzle-to-react-promise

1. Go to this page and download the library: Download tickner/guzzle-to-react-promise library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tickner / guzzle-to-react-promise example snippets




use GuzzleHttp\Promise\Promise as GuzzlePromise;
use function Tickner\GuzzleToReactPromise\guzzleToReactPromise;

$guzzlePromise = new GuzzlePromise(); // or a guzzle http request

$reactPromise = guzzleToReactPromise($guzzlePromise);

$reactPromise
    ->then(
        function($fulfilledValue) {
            echo $fulfilledValue;
        }
    )
;

$guzzlePromise->resolve('the val');