1
1
# ReactPHP Runtime wrapper for ext-parallel
2
2
3
- [ ![ Linux Build Status ] ( https://travis-ci .com/Reactphp-parallel/runtime.png )] ( https://travis-ci.com/Reactphp-parallel/runtime )
3
+ ![ Continuous Integration ] ( https://github .com/Reactphp-parallel/runtime/workflows/Continuous%20Integration/badge.svg )
4
4
[ ![ Latest Stable Version] ( https://poser.pugx.org/React-parallel/runtime/v/stable.png )] ( https://packagist.org/packages/React-parallel/runtime )
5
5
[ ![ Total Downloads] ( https://poser.pugx.org/React-parallel/runtime/downloads.png )] ( https://packagist.org/packages/React-parallel/runtime )
6
6
[ ![ Code Coverage] ( https://scrutinizer-ci.com/g/Reactphp-parallel/runtime/badges/coverage.png?b=master )] ( https://scrutinizer-ci.com/g/Reactphp-parallel/runtime/?branch=master )
7
- [ ![ License ] ( https://poser.pugx.org/React -parallel/runtime/license.png )] ( https://packagist.org/packages/react -parallel/runtime )
8
- [ ![ PHP 7 ready ] ( http ://php7ready.timesplinter.ch/Reactphp -parallel/runtime/badge.svg )] ( https://travis-ci .org/Reactphp -parallel/runtime )
7
+ [ ![ Type Coverage ] ( https://shepherd.dev/github/Reactphp -parallel/runtime/coverage.svg )] ( https://shepherd.dev/github/Reactphp -parallel/runtime )
8
+ [ ![ License ] ( https ://poser.pugx.org/React -parallel/runtime/license.png )] ( https://packagist .org/packages/React -parallel/runtime )
9
9
10
10
### Installation ###
11
11
@@ -18,17 +18,18 @@ composer require react-parallel/runtime
18
18
# Usage
19
19
20
20
``` php
21
- $autoloader = \dirname(__DIR__) . '/vendor/autoload.php';
22
- require $autoloader;
21
+ use React\EventLoop\Factory;
22
+ use ReactParallel\Runtime\Runtime;
23
+ use ReactParallel\FutureToPromiseConverter\FutureToPromiseConverter;
23
24
24
25
$loop = Factory::create();
25
- $runtime = new Runtime(new FutureToPromiseConverter($loop), $autoloader );
26
+ $runtime = Runtime::create (new FutureToPromiseConverter($loop));
26
27
27
28
$runtime->run(function () {
28
29
sleep(3);
29
30
30
31
return 3;
31
- })->then (function (int $int): void {
32
+ })->done (function (int $int): void {
32
33
echo $int, PHP_EOL;
33
34
});
34
35
0 commit comments