PHPackages                             riftfox/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. [HTTP &amp; Networking](/categories/http)
4. /
5. riftfox/php-http-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

riftfox/php-http-client
=======================

A lightweight PSR-18 HTTP client wrapper allowing custom response transformation via result factories.

v0.1.0(4mo ago)00MITPHP

Since Dec 26Pushed 4mo agoCompare

[ Source](https://github.com/riftfox/php-http-client)[ Packagist](https://packagist.org/packages/riftfox/php-http-client)[ RSS](/packages/riftfox-php-http-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Riftfox PHP HTTP Client
=======================

[](#riftfox-php-http-client)

A lightweight PSR-18 HTTP client wrapper allowing custom response transformation via result factories.

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

[](#requirements)

- PHP &gt;= 7.4
- A PSR-18 HTTP Client implementation (e.g., Guzzle, Symfony HttpClient)
- PSR-7 HTTP Message implementation

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

[](#installation)

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

Usage
-----

[](#usage)

This library separates the HTTP transport (PSR-18) from the response processing logic (ResultFactory).

### 1. Create a Result and a Factory

[](#1-create-a-result-and-a-factory)

Implement `ResultInterface` for your data object and `ResultFactoryInterface` to transform the PSR-7 response into that object.

```
namespace App\Http;

use Riftfox\HttpClient\ResultInterface;
use Riftfox\HttpClient\ResultFactoryInterface;
use Psr\Http\Message\ResponseInterface;

class UserResult implements ResultInterface
{
    public array $data;

    public function __construct(array $data)
    {
        $this->data = $data;
    }
}

class UserResultFactory implements ResultFactoryInterface
{
    public function create(ResponseInterface $response): ResultInterface
    {
        $json = (string) $response->getBody();
        $data = json_decode($json, true);

        return new UserResult($data ?? []);
    }
}
```

### 2. Send a Request

[](#2-send-a-request)

```
use Riftfox\HttpClient\HttpClient;
use GuzzleHttp\Client as GuzzleClient; // Example PSR-18 Client
use GuzzleHttp\Psr7\Request;

// 1. Initialize the PSR-18 client and your wrapper
$psrClient = new GuzzleClient();
$client = new HttpClient($psrClient);

// 2. Prepare the request and the factory
$request = new Request('GET', 'https://api.example.com/users/1');
$factory = new UserResultFactory();

// 3. Send request and get the transformed result directly
/** @var UserResult $result */
$result = $client->send($request, $factory);

print_r($result->data);
```

Testing
-------

[](#testing)

Run the test suite with Codeception:

```
vendor/bin/codecept run unit
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance74

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

143d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2f83fc1441b0327a7863692c3e6f29ab3eee08154adba4dde3399c3a4fcfe06?d=identicon)[Riftfox](/maintainers/Riftfox)

---

Top Contributors

[![riftfox](https://avatars.githubusercontent.com/u/207349619?v=4)](https://github.com/riftfox "riftfox (2 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[akamai-open/edgegrid-client

Implements the Akamai {OPEN} EdgeGrid Authentication specified by https://developer.akamai.com/introduction/Client\_Auth.html

482.5M6](/packages/akamai-open-edgegrid-client)[art4/requests-psr18-adapter

Use WordPress/Requests as a PSR-18 HTTP client

153.3k](/packages/art4-requests-psr18-adapter)

PHPackages © 2026

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