[ 'foo' => ['id' => 1, '...'], 'baz' => ['id' => 2, '...'], ]; $requests = function ($params) use ($client) { $uri = 'http://localhost/sample/'; foreach ($params as $key => $param) { yield $key => fn() => $client->requestAsync('GET', $uri . $param['id']); } }; $pool = new Pool($client, $requests($params), [ 'concurrency' => 10, 'fulfilled' => fn(Response $res, $key) => print("{$params[$key]['id']}\n"), 'rejected' => fn(ClientExceptionInterface $reason, $key) => [], ]);