trail / http
A small http client for trail
0.4.0
2026-10-18 06:57 UTC
Requires
- php: >=8.4
- ext-curl: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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);