PHPackages                             giantvlad/braintreehttp - 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. giantvlad/braintreehttp

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

giantvlad/braintreehttp
=======================

The PHP Http client. The fork of braintree/braintreehttp

0.4.2(3y ago)026MITPHPPHP &gt;=7.3

Since Jun 4Pushed 3y agoCompare

[ Source](https://github.com/GiantVlad/braintreehttp_php)[ Packagist](https://packagist.org/packages/giantvlad/braintreehttp)[ RSS](/packages/giantvlad-braintreehttp/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Braintree HttpClient [![Build Status](https://camo.githubusercontent.com/fe44a3540043696b06cf8e4890d9ce387c6d682fdef66f2c4217e4d9dd227e5c/68747470733a2f2f7472617669732d63692e6f72672f627261696e747265652f627261696e74726565687474705f7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/braintree/braintreehttp_php)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#braintree-httpclient-)

BraintreeHttp is a generic HTTP Client.

In it's simplest form, an [`HttpClient`](./lib/BraintreeHttp/HttpClient.php) exposes an `execute` method which takes an [HTTP request](./lib/BraintreeHttp/HttpRequest.php), executes it against the domain described in an [Environment](./lib/BraintreeHttp/Environment.php), and returns an [HTTP response](./lib/BraintreeHttp/HttpResponse.php).

### Environment

[](#environment)

An [`Environment`](./lib/braintreehttp/environment.rb) describes a domain that hosts a REST API, against which an `HttpClient` will make requests. `Environment` is a simple interface that wraps one method, `baseUrl`.

```
$env = new Environment('https://example.com');
```

### Requests

[](#requests)

HTTP requests contain all the information needed to make an HTTP request against the REST API. Specifically, one request describes a path, a verb, any path/query/form parameters, headers, attached files for upload, and body data.

### Responses

[](#responses)

HTTP responses contain information returned by a server in response to a request as described above. They are simple objects which contain a status code, headers, and any data returned by the server.

```
$request = new HttpRequest("/path", "GET");
$request->body[] = "some data";

$response = $client->execute($req);

$statusCode = $response->statusCode;
$headers = $response->headers;
$data = $response->result;
```

### Injectors

[](#injectors)

Injectors are blocks that can be used for executing arbitrary pre-flight logic, such as modifying a request or logging data. Injectors are attached to an `HttpClient` using the `addInjector` method.

The `HttpClient` executes its injectors in a first-in, first-out order, before each request.

```
class LogInjector implements Injector
{
    public function inject($httpRequest)
    {
        // Do some logging here
    }
}

$logInjector = new LogInjector();
$client = new HttpClient($environment);
$client->addInjector($logInjector);
...
```

### Error Handling

[](#error-handling)

`HttpClient#execute` may throw an `Exception` if something went wrong during the course of execution. If the server returned a non-200 response, [IOException](./lib/BraintreeHttp/IOException.php) will be thrown, that will contain a status code and headers you can use for debugging.

```
try
{
    $client->execute($req);
}
catch (HttpException $e)
{
    $statusCode = $e->response->statusCode;
    $headers = $e->response->headers;
    $body = $e->response->result;
}
```

License
-------

[](#license)

BraintreeHttp-PHP is open source and available under the MIT license. See the [LICENSE](./LICENSE) file for more information.

Contributing
------------

[](#contributing)

Pull requests and issues are welcome. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.7% 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 ~0 days

Total

2

Last Release

1115d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b8b156464feda8567802b7004a6da665892d6b8516ccd0ca722d3dcc6674f69?d=identicon)[GiantVlad](/maintainers/GiantVlad)

---

Top Contributors

[![braintreeps](https://avatars.githubusercontent.com/u/200407?v=4)](https://github.com/braintreeps "braintreeps (24 commits)")[![GiantVlad](https://avatars.githubusercontent.com/u/13560186?v=4)](https://github.com/GiantVlad "GiantVlad (3 commits)")[![demerino](https://avatars.githubusercontent.com/u/7817434?v=4)](https://github.com/demerino "demerino (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/giantvlad-braintreehttp/health.svg)

```
[![Health](https://phpackages.com/badges/giantvlad-braintreehttp/health.svg)](https://phpackages.com/packages/giantvlad-braintreehttp)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.5k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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