Download the PHP package ngawidev/nethttp without Composer
On this page you can find all versions of the php package ngawidev/nethttp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nethttp
NetHttp
Lightweight PHP HTTP client with fluent interface, cURL-powered.
Installation
Quick Start
Table of Contents
- Client
- Request
- Response
- Headers
- Authentication
- Query Parameters
- Request Body
- File Upload
- Download File
- Proxy
- Cookies
- SSL
- Timeout
- Retry
- Gzip
- Redirect
- Curl Options
- Middleware
- Debug Mode
- Request Logging
- Concurrent Requests
- Async/Await
- Zstd Auto Decode
- Browser Mimic
- Error Handling
Client
Client holds connection configuration. Each Client::new() creates a fresh instance.
| Method | Description |
|---|---|
Client::new() |
Create new client instance |
base(string $url) |
Set base URL |
userAgent(string $agent) |
Set default User-Agent (default: NetHttp/1.0) |
sslVerify(bool) |
Enable/disable SSL verification (default: false) |
defaultTimeout(int $seconds) |
Set default timeout (default: 300) |
maxRedirects(int $max) |
Set max redirects (default: 5) |
debug(bool) |
Enable debug mode |
retry(int $times, int $delayMs) |
Set retry count and delay |
proxy(string $ip, int $port) |
Set HTTP proxy |
proxyHttp(string $ip, int $port) |
Set HTTP proxy |
proxySocks5(string $ip, int $port) |
Set SOCKS5 proxy |
proxyAuth(string $user, string $pass) |
Set proxy authentication |
cookie() |
Enable cookies |
cookieJar(string $path) |
Set cookie file (read/write) |
cookieFile(string $path) |
Set cookie file (read only) |
sendCookie(string $key, string $value) |
Send a cookie |
sendCookies(array $cookies) |
Send multiple cookies |
curlOpt(array $options) |
Set default cURL options |
before(callable $callback) |
Add before middleware |
after(callable $callback) |
Add after middleware |
getLogs() |
Get request logs |
clearLogs() |
Clear request logs |
Request
Request is built from $client->request().
| Method | Description |
|---|---|
get(string $url) |
Set GET request |
post(string $url) |
Set POST request |
put(string $url) |
Set PUT request |
patch(string $url) |
Set PATCH request |
delete(string $url) |
Set DELETE request |
timeout(int $seconds) |
Set request timeout |
connectTimeout(int $seconds) |
Set connection timeout |
maxRedirects(int $max) |
Set max redirects for this request |
gzip(bool) |
Enable gzip encoding |
asFile(string $path) |
Save response to file |
debug(bool) |
Enable debug for this request |
curlOpt(array $options) |
Set cURL options for this request |
send() |
Execute request and return Response |
Response
| Method | Description |
|---|---|
header(string $key) |
Get response header (case-insensitive) |
json() |
Get data as array |
xml() |
Get data as SimpleXMLElement |
body() |
Get raw body as string |
Headers
Authentication
Query Parameters
Request Body
File Upload
Download File
Proxy
Cookies
SSL
Timeout
Retry
Gzip
Zstd Auto Decode
Response dengan Content-Encoding: zstd atau zstd-compressed data akan otomatis di-decode jika ext-zstd terinstall.
Cek availability:
Kalau ext-zstd tidak terinstall:
Browser Mimic
Mimic browser fingerprint dengan versi yang presisi. Setiap browser mengirim headers yang berbeda, termasuk Sec-CH-UA (Client Hints) untuk Chrome/Edge.
Basic Usage
Supported Browsers
| Browser | Version Range | Sec-CH-UA | Sec-Fetch-* |
|---|---|---|---|
| Chrome | 124 - 154 | Yes | Yes |
| Firefox | 124 - 156 | No | Yes |
| Edge | 124 - 154 | Yes | Yes |
| Safari | 18 - 26 | No | No |
Version Ranges
Header Details
Chrome 150 - includes Client Hints:
Firefox 153 - NO Client Hints (Firefox tidak kirim):
Safari 26 - NO Sec-Fetch (Safari tidak kirim):
Get Profile Info
Override Headers
Redirect
Curl Options
Middleware
Debug Mode
Output:
Request Logging
Concurrent Requests
Async/Await (Promise-like)
Async execution tanpa dependency external. Menggunakan curl_multi di backend.
Single Async
Async with Callbacks
Parallel Async Pool
Parallel with Callbacks
Error Handling
License
MIT
All versions of nethttp with dependencies
ext-curl Version *