Search by

trail / http

dodgycoffee

A small http client for trail

0.4.0 2026-10-18 06:57 UTC

This package is auto-updated.

Last update: 2026-10-18 08:01:07 UTC


README

A small http client for trail

install

composer require trail/http

Requires curl which like... everyone has

use

use Trail\Http\Http;

public function __construct(private Http $http) {}

$reply = $this->http->get('https://api.example.com/things', headers: ['Accept' => 'application/json']);
$reply->status;
$reply->header('etag');
$reply->json();
$reply->isOk();

$this->http->post($url, json: ['name' => 'cat']);
$this->http->post($url, body: ['name' => 'cat']);
$this->http->put($url, body: fopen($path, 'rb'));
$this->http->get($url, saveTo: '/tmp/big.zip', maxBytes: 50_000_000);
$this->http->get($url, redirects: 3, timeout: 10);