1. Go to this page and download the library: Download antevemus/alinq-revolt 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/ */
antevemus / alinq-revolt example snippets
declare(strict_types=1);
use Antevemus\ALinqRevolt\ALinqAsyncCollection;
use function Amp\delay;
$started = microtime(true);
// Eight calls to a slow service; Amp\delay() stands for an Amp HTTP client or an async SDK
$activeIds = ALinqAsyncCollection::from([101, 102, 103, 104, 105, 106, 107, 108])
->selectAsync(function (int $id): array {
delay(0.1); // 100 ms of non-blocking I/O
return ['id' => $id, 'active' => $id % 2 === 1];
}, concurrency: 8)
->where(fn(array $profile) => $profile['active']) // the core operators chain after it
->select(fn(array $profile) => $profile['id'])
->toArray();
// Result: [101, 103, 105, 107]
$elapsed = microtime(true) - $started;
$elapsed < 0.4; // true (the eight waits overlapped: about 0.1 s, not 0.8 s)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.