How ngawidev/netstream works
NetStream is a dependency-light PHP HTTP client built on PHP streams. Callers use the static facade or a reusable Client; each creates or configures a PendingRequest that builds and executes a request, then returns a Response. The request layer supports documented options including retries, redirects, TLS/proxy settings, multipart uploads, downloads, limits and debugging. CookieJar enables persistent cookie matching across requests. The sampled code supports the core wiring shown; other capabilities are included at the documented request-options level.
Main entry points: PendingRequest.php Request builder · Response.php Response object · NetStream.php Static facade · Client.php Reusable client
Components 11
Client entry points
- Static facade
src/NetStream.php - Reusable client
src/Client.php
Request execution
- Request builder
src/PendingRequest.php - Request options
src/PendingRequest.php - PHP stream transport
src/PendingRequest.php
Session state
- Cookie jar
src/CookieJar.php
Response handling
- Response object
src/Response.php - Connection errors
src/Exceptions/ConnectionException.php - Request errors
src/Exceptions/RequestException.php
Other components
- Application caller
- HTTP service
Connections 15
- Application caller → Static facade: calls
- Application caller → Reusable client: configures
- Static facade → Reusable client: creates or calls
- Static facade → Request builder: configures
- Reusable client → Request builder: creates and configures
- Request builder → Request options: builds
- Request builder → Cookie jar: loads and stores cookies
- Request builder → PHP stream transport: executes
- PHP stream transport → HTTP service: sends request
- HTTP service → PHP stream transport: returns response
- PHP stream transport → Response object: constructs
- PHP stream transport → Connection errors: raises
- Response object → Application caller: returns
- Response object → Cookie jar: parses cookie lines
- Response object → Request errors: throws on failure