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

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

Notifications You must be signed in to change notification settings

adrianmihaila/reactphp-promise-wait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages