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

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

extensopartner/braintreehttp
============================

0.3.0(8y ago)03MITPHP

Since Sep 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/extensopartner/braintreehttp_php)[ Packagist](https://packagist.org/packages/extensopartner/braintreehttp)[ RSS](/packages/extensopartner-braintreehttp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (11)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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~27 days

Recently: every ~43 days

Total

9

Last Release

2944d ago

### Community

Maintainers

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

---

Top Contributors

[![braintreeps](https://avatars.githubusercontent.com/u/200407?v=4)](https://github.com/braintreeps "braintreeps (24 commits)")[![extensopartner](https://avatars.githubusercontent.com/u/10133828?v=4)](https://github.com/extensopartner "extensopartner (2 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/extensopartner-braintreehttp/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M318](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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