PHPackages                             ez-php/http-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. ez-php/http-client

ActiveLibrary[Framework](/categories/framework)

ez-php/http-client
==================

HTTP client module for the ez-php framework — fluent cURL-based client for making outgoing HTTP requests

1.11.1(1mo ago)0681MITPHPPHP ^8.5CI passing

Since Mar 15Pushed 1mo agoCompare

[ Source](https://github.com/ez-php/http-client)[ Packagist](https://packagist.org/packages/ez-php/http-client)[ Docs](https://github.com/ez-php/http-client)[ RSS](/packages/ez-php-http-client/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (16)Versions (43)Used By (1)

ez-php/http-client
==================

[](#ez-phphttp-client)

HTTP client module for the [ez-php framework](https://github.com/ez-php/framework) — fluent cURL-based client for outgoing HTTP requests, a static `Http` façade, and a `FakeTransport` for testing.

[![CI](https://github.com/ez-php/http-client/actions/workflows/ci.yml/badge.svg)](https://github.com/ez-php/http-client/actions/workflows/ci.yml)

Requirements
------------

[](#requirements)

- PHP 8.5+
- ext-curl
- ez-php/framework 0.\*

Installation
------------

[](#installation)

```
composer require ez-php/http-client
```

Setup
-----

[](#setup)

Register the service provider:

```
$app->register(\EzPhp\HttpClient\HttpClientServiceProvider::class);
```

Usage
-----

[](#usage)

```
use EzPhp\HttpClient\Http;

// Static façade (wired by provider)
$response = Http::get('https://api.example.com/users')->send();
$response = Http::post('https://api.example.com/users')
    ->withJson(['name' => 'Alice'])
    ->send();

echo $response->status();    // 200
echo $response->body();      // raw response body
$data = $response->json();   // decoded JSON array
$ok   = $response->ok();     // true for 2xx

// Convenience shortcuts
$data   = Http::get('https://api.example.com/users')->json();
$body   = Http::get('https://api.example.com/data')->body();
$status = Http::delete('https://api.example.com/users/1')->status();
```

### Fluent request builder

[](#fluent-request-builder)

```
Http::post('https://api.example.com/upload')
    ->withHeader('Authorization', 'Bearer token123')
    ->withJson(['name' => 'Alice'])
    ->send();

Http::post('https://api.example.com/form')
    ->withForm(['field' => 'value'])
    ->send();
```

### Injected client (without façade)

[](#injected-client-without-façade)

```
use EzPhp\HttpClient\HttpClient;

$client = $app->make(HttpClient::class);
$response = $client->get('https://api.example.com')->send();
```

Testing
-------

[](#testing)

Replace the transport with a fake in tests:

```
use EzPhp\HttpClient\FakeTransport;
use EzPhp\HttpClient\Http;
use EzPhp\HttpClient\HttpClient;
use EzPhp\HttpClient\HttpResponse;

$fake = new FakeTransport(new HttpResponse(200, '{"id":1}', []));
Http::setClient(new HttpClient($fake));

// Act — no real network calls
$data = Http::get('https://api.example.com/users/1')->json();

Http::resetClient();
```

Error handling
--------------

[](#error-handling)

`HttpClientException` is thrown only on **transport failures** (cURL error, DNS failure, empty URL). HTTP 4xx/5xx responses are returned as normal `HttpResponse` objects — check `ok()` or `status()`.

Classes
-------

[](#classes)

ClassDescription`TransportInterface`I/O seam: `send(method, url, headers, body): HttpResponse``CurlTransport`cURL implementation — all `curl_*` calls are isolated here`FakeTransport`Test double that returns pre-configured `HttpResponse` objects`HttpClient`Entry point; factory methods (`get`, `post`, `put`, `patch`, `delete`) returning `HttpRequest``HttpRequest`Fluent builder; clone-based withers; dispatch shortcuts (`send`, `json`, `body`, `status`)`HttpResponse`Immutable value object: `status()`, `body()`, `json()`, `header()`, `ok()``HttpClientException`Thrown on transport-level failures (not on 4xx/5xx)`Http`Static façade backed by a managed `HttpClient` singleton`HttpClientServiceProvider`Binds transport + client; wires static façade; eager bootLicense
-------

[](#license)

MIT — [Andreas Uretschnig](mailto:andreas.uretschnig@gmail.com)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance91

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

42

Last Release

44d ago

Major Versions

0.9.3 → 1.0.02026-03-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/122030400?v=4)[AU9500](/maintainers/AU9500)[@AU9500](https://github.com/AU9500)

---

Top Contributors

[![AU9500](https://avatars.githubusercontent.com/u/122030400?v=4)](https://github.com/AU9500 "AU9500 (129 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (13 commits)")

---

Tags

httpphpframeworkcurlhttp clientez-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ez-php-http-client/health.svg)

```
[![Health](https://phpackages.com/badges/ez-php-http-client/health.svg)](https://phpackages.com/packages/ez-php-http-client)
```

###  Alternatives

[php-curl-class/php-curl-class

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.

3.3k9.8M372](/packages/php-curl-class-php-curl-class)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
