1. Go to this page and download the library: Download innmind/async-time-warp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
innmind / async-time-warp example snippets
use Innmind\Async\TimeWarp\Halt;
use Innmind\TimeContinuum\Earth\{
Clock,
Period\Second,
};
use Innmind\Mantle\{
Source\Predetermined,
Suspend,
Forerunner,
};
$clock = new Clock;
$source = Predetermined::of(
static function(Suspend $suspend) use ($clock) {
$halt = Halt::of($clock, $suspend);
$halt(new Second(2));
echo 'World !';
},
static function(Suspend $suspend) use ($clock) {
$halt = Halt::of($clock, $suspend);
$halt(new Second(1));
echo 'Hello ';
},
);
Forerunner::of($clock)(null, $source); // will print "Hello World !" in 2 seconds
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.