1. Go to this page and download the library: Download agussuroyo/async 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/ */
agussuroyo / async example snippets
use AgusSuroyo\Async\Async;
$async = new Async();
$future = $async->run(function () {
return fetchPrice('SKU-1');
});
$price = $future->await(); // blocks until the child finishes
$future = $async->run(function () {
throw new \RuntimeException('boom');
});
try {
$future->await();
} catch (\RuntimeException $e) {
// 'boom' — child file/line/trace are appended to the message
}
$async = new Async(4); // at most 4 children at once
$async->max(8); // change later
foreach ($items as $item) {
$async->run(function () use ($item) {
process($item);
});
}
$async->wait(); // blocks until every scheduled child has finished
sh
docker compose up -d
docker compose exec php composer test
docker compose exec php composer analyse
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.