Concurrent HTTP request execution for Instructor.
http-pool is intentionally separate from http-client:
http-clienthandles one request at a timehttp-poolhandles many requests at once
use Cognesy\Http\Collections\HttpRequestList;
use Cognesy\Http\Data\HttpRequest;
use Cognesy\HttpPool\Config\HttpPoolConfig;
use Cognesy\HttpPool\HttpPool;
$pool = HttpPool::fromConfig(new HttpPoolConfig(driver: 'guzzle'));
$responses = $pool->pool(
HttpRequestList::of(
new HttpRequest('https://example.com/a', 'GET', [], '', []),
new HttpRequest('https://example.com/b', 'GET', [], '', []),
),
maxConcurrent: 2,
);packages/http-pool/docs/overview.mdpackages/http-pool/docs/quickstart.mdpackages/http-pool/docs/custom-handlers.md