Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Latest commit

 

History

History
31 lines (22 loc) · 683 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 683 Bytes

ReactPHP promise/wait Build Status

This lightweight library provides a wait functionality for ReactPHP/promise library.

Installation

composer require adimihaila/promise-wait

Usage

<?php

use React\Promise\Deferred;

function doAsyncSomething() {
    $deferred = new Deferred();
    $deferred->resolve($value);

    return $deferred->promise();
}

$value = doAsyncSomething()
    ->then(function ($response) {
        sleep(5);
        
        return $response++;
    });
    
echo \AdiMihaila\Promise\wait($value);