PHPackages                             wp-php-toolkit/http-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. wp-php-toolkit/http-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

wp-php-toolkit/http-client
==========================

HttpClient component for WordPress.

v0.8.1(1mo ago)0119.2k↑99233.3%5GPL-2.0-or-laterPHPPHP &gt;=7.2

Since May 30Pushed 1mo agoCompare

[ Source](https://github.com/wp-php-toolkit/http-client)[ Packagist](https://packagist.org/packages/wp-php-toolkit/http-client)[ Docs](https://wordpress.github.io/php-toolkit/reference/httpclient.html)[ RSS](/packages/wp-php-toolkit-http-client/feed)WikiDiscussions trunk Synced yesterday

READMEChangelogDependencies (12)Versions (49)Used By (5)

   slug httpclient   title HttpClient   install wp-php-toolkit/http-client   see\_also    ../learn/04-talking-to-the-network.html | Tutorial — Talking to the network | Walks through a streaming downloader that resumes, fans out, and pipes bytes to disk without buffering.

 bytestream | ByteStream | Stream request and response bodies.

 filesystem | Filesystem | Persist large downloads without buffering them in memory.

 corsproxy | CORSProxy | Bridge browser-side tools to servers without CORS headers.

    Async HTTP client without `curl` required. Uses sockets when curl is missing, supports concurrent requests and streaming responses.

Why this exists
---------------

[](#why-this-exists)

A plugin installer starts with one request to download `plugin.zip`. A migration then adds progress reporting, a ten-request media window, resumable downloads, and a remote ZIP reader that feeds ZipFilesystem directly. Those workflows need the same request API from the first GET to the final streamed archive.

The HttpClient component gives the toolkit a small request/response model, middleware for redirects and caching, concurrent fetches, and response bodies exposed as byte streams. It runs through curl when PHP provides curl and through PHP sockets when it does not. Callers keep the same request and response model while the transport changes underneath.

Use it to fetch plugin metadata, submit import callbacks, mirror a media library, read a WXR export, or pipe a remote archive into Zip and Filesystem code.

GET a URL
---------

[](#get-a-url)

**Network access in the demo runtime.** Live request examples show the real API, but outbound HTTP in browser sandboxes may require a CORS proxy.

The smallest flow has three steps: create a request, wait until headers arrive, then consume the body stream. This is intentionally close to the Fetch API shape, but the body is a toolkit byte stream instead of a buffered string.

```
