2017 © Pedro Peláez
 

library react-co

Simple reactphp coroutines

image

mkusher/react-co

Simple reactphp coroutines

  • Sunday, August 7, 2016
  • by mkusher
  • Repository
  • 1 Watchers
  • 9 Stars
  • 3,906 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

Reactphp Co

Build Status, (*1)

Simple coroutines for your reactphp applications., (*2)

Installation

Use composer to install this package, (*3)

composer require mkusher/react-co

Coroutines

Don't know what coroutines are? Read this awesome article by Nikita Popov, (*4)

Examples

Basic example where asyncOp1 and asyncOp2 your asynchronous functions that return instance of PromiseInterface., (*5)


use Mkusher\Co; Co\await(function() { $a = yield asyncOp1(); $b = yield asyncOp2($a); });

await returns Promise, so that you can wait for all your operatoins to complete like:, (*6)


use Mkusher\Co; Co\await(function() { $a = yield asyncOp1(); return "10"; })->then(function($result) { echo $result; });

This example will write "10" after executing asyncOp1., (*7)

You can find more examples in examples dir, (*8)

The Versions

07/08 2016

dev-master

9999999-dev

Simple reactphp coroutines

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleh Kashnikau