reactphp / promise

Promises/A implementation for PHP.
https://reactphp.org/promise/
MIT License
2.38k stars 146 forks source link

Any package has been made for alternatives about async/await? #125

Closed gai00 closed 6 years ago

gai00 commented 6 years ago

As title, just like javascript async/await.

(async function() {
var a = await asyncA();
var b = await asyncB();
})();

I noticed a generator version here: https://tc39.github.io/ecmascript-asyncawait/#desugaring and I made it by PHP. https://gist.github.com/gai00/8f1ce9fcecc2d5009e5a0f453485a5b0

I think maybe someone has been made this, and better.

WyriHaximus commented 6 years ago

Hey, yes there is a package for that. It's called recoilphp: https://github.com/recoilphp/recoil

clue commented 6 years ago

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can reopen this :+1:

thesebas commented 4 years ago

I've recently created this https://github.com/thesebas/php-promise-async-await library which implementation is quite similar to gist created by @gai00, I've also added some tests, maybe it is worth improving?

WyriHaximus commented 4 years ago

Looks interesting, maybe worth revisiting? /cc @clue @jsor

clue commented 4 years ago

@thesebas Cool, looks interesting! Make sure to also add this to our wiki: https://github.com/reactphp/reactphp/wiki/Users