1. Go to this page and download the library: Download eav93/wreq-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eav93 / wreq-php example snippets
use Wreq\Client;
// One reusable client === one connection pool.
$client = new Client([
'emulation' => 'chrome_131', // browser fingerprint
'pool_max_idle_per_host' => 8, // TCP connections kept per host
'cookies' => true, // shared cookie jar
'timeout' => 30.0,
]);
$response = $client->get('https://api.example.com/users', ['page' => 1]);
$response->status(); // int
$response->successful(); // 2xx?
$response->body(); // string
$response->json('data.0.name', 'default'); // dot-notation + default
$response->object(); // stdClass graph
$response->header('Content-Type');
// POST JSON (default) — connections reused from the same pool.
$client->post('https://api.example.com/users', ['name' => 'Ada']);
// Per-request tweaks return a new immutable builder; the pool is untouched.
$client->asForm()->post($url, ['field' => 'value']);
$client->withToken('secret')->withHeaders(['X-Trace' => '1'])->get($url);
// multipart/form-data — attach files alongside text fields.
$client->attach('photo', file_get_contents('p.jpg'), 'p.jpg', 'image/jpeg')
->post($url, ['caption' => 'Sunset']);
// Stream large downloads straight to disk — the body never enters PHP memory,
// so peak memory stays flat no matter how big the file is.
$response = $client->sink('/tmp/large.zip')->get('https://example.com/large.zip');
$response->savedTo(); // '/tmp/large.zip'
$response->downloadedBytes(); // bytes written (body() is empty for a sink)
// Release the pool and close every idle socket now.
$client->close();
use Wreq\Emulation;
Emulation::all(); // every supported profile name
Emulation::random(); // a random profile
Emulation::random('chrome'); // a random Chrome version
Emulation::like('firefox'); // all Firefox profile names
Emulation::exists('chrome_131');
ini
extension=/path/printed/by/the/installer/wreq_php.so
bash
cargo build --release
# then point php.ini at target/release/libwreq_php.so
dockerfile
FROM php:8.3-cli
WORKDIR /app
COPY . /app
# ... install your Composer dependencies (vendor/) as you normally would ...
# Fetch the matching wreq_php binary and enable it. The installer picks the
# build for this image's PHP version, OS, libc and architecture.
RUN php -r '