PHPackages                             jbzoo/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. jbzoo/http-client

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

jbzoo/http-client
=================

Simple HTTP-client, wrapper around Guzzle and rmccue/requests

7.1.1(7mo ago)7148.4k15MITPHPPHP ^8.2CI passing

Since Jul 31Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/JBZoo/Http-Client)[ Packagist](https://packagist.org/packages/jbzoo/http-client)[ RSS](/packages/jbzoo-http-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (28)Used By (5)

JBZoo / Http-Client
===================

[](#jbzoo--http-client)

[![CI](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://camo.githubusercontent.com/2440f1dd58aa5c6e9c4f47dd20436817fd265e6ccba9fe2027e28fe90bafcf6c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a425a6f6f2f487474702d436c69656e742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/JBZoo/Http-Client?branch=master) [![Psalm Coverage](https://camo.githubusercontent.com/c61cbf6c6e5c19352c32e32d2721d9f1f26b6eecdb1e454e0e52813566b3660c/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f487474702d436c69656e742f636f7665726167652e737667)](https://shepherd.dev/github/JBZoo/Http-Client) [![Psalm Level](https://camo.githubusercontent.com/e89b5f5a084249c79e4f427099b7042ffca630152f2c1e97c60d62567a7891c6/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f487474702d436c69656e742f6c6576656c2e737667)](https://shepherd.dev/github/JBZoo/Http-Client) [![CodeFactor](https://camo.githubusercontent.com/2ce028cbfdea1f60e0f2b91a3a93b1474a15bc3203369e7bc48858d1965cfb76/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6a627a6f6f2f687474702d636c69656e742f6261646765)](https://www.codefactor.io/repository/github/jbzoo/http-client/issues)[![Stable Version](https://camo.githubusercontent.com/45dc6675e3a3fe6c5a76e79b2f67a04af7f42ce18846d0f92d8611206b5c0f17/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f687474702d636c69656e742f76657273696f6e)](https://packagist.org/packages/jbzoo/http-client/) [![Total Downloads](https://camo.githubusercontent.com/14798c84d9dc1436451707649d253d65b04e4edadd6a6467241d82dc3e44f176/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f687474702d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/jbzoo/http-client/stats) [![Dependents](https://camo.githubusercontent.com/e3fcc844b5a3edd53571940c5dff0b5105d74377f31e59d3a07f94fce9585652/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f687474702d636c69656e742f646570656e64656e7473)](https://packagist.org/packages/jbzoo/http-client/dependents?order_by=downloads) [![GitHub License](https://camo.githubusercontent.com/b009ae432f4998b5c69e532f2fd79fa69b71e3ef578dfe4aca6c58ba9dde99cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a627a6f6f2f687474702d636c69656e74)](https://github.com/JBZoo/Http-Client/blob/master/LICENSE)

A simple, intuitive PHP HTTP client that provides a clean wrapper around popular HTTP libraries like Guzzle and rmccue/requests. Make HTTP requests with minimal code and maximum flexibility.

Features
--------

[](#features)

- **Simple API**: Clean, one-line HTTP requests without complex configuration
- **Multiple Backends**: Automatic driver selection (Guzzle preferred, rmccue/requests fallback)
- **Parallel Requests**: Built-in support for concurrent HTTP requests using curl\_multi\_\*
- **Flexible Response Handling**: Access response data via methods, properties, or array syntax
- **JSON Support**: Built-in JSON parsing with JBZoo/Data integration
- **Event System**: Hook into request lifecycle with event listeners
- **PHP 8.2+ Ready**: Modern PHP with strict typing and best practices

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

[](#requirements)

- PHP 8.2 or higher
- ext-json

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

[](#installation)

```
composer require guzzlehttp/guzzle --no-update # Recommended, but not required
composer require jbzoo/http-client
```

Quick Start
-----------

[](#quick-start)

```
use JBZoo\HttpClient\HttpClient;

// Simple GET request
$client = new HttpClient();
$response = $client->request('https://api.github.com/users/octocat');

echo $response->getBody(); // JSON response
echo $response->getCode(); // 200
```

Usage
-----

[](#usage)

```
use JBZoo\HttpClient\HttpClient;

// Configure client (no options required!)
$httpClient = new HttpClient([
    'auth'            => [          // Simple HTTP auth
        'http-user-name',
        'http-password'
    ],
    'headers'         => [          // Your custom headers
        'X-Custom-Header' => 42,
    ],
    'driver'          => 'auto',    // (Auto|Guzzle5|Guzzle6|Rmccue)
    'timeout'         => 10,        // Wait in seconds
    'verify'          => false,     // Check cert for SSL
    'exceptions'      => false,     // Show exceptions for statuses 4xx and 5xx
    'allow_redirects' => true,      // Show real 3xx-header or result?
    'max_redirects'   => 10,        // How much to redirect?
    'user_agent'      => "It's me", // Custom UserAgent
]);

// Just request
$response = $httpClient->request('http://my.site.com/', [
    'key-1' => 'value-1',
    'key-2' => 'value-2'
], 'post');
```

### Response Methods

[](#response-methods)

```
// Get status code
$code = $response->getCode();
$code = $response->code;
$code = $response['code'];

// Get headers
$headers = $response->getHeaders();
$headers = $response->headers;
$headers = $response['headers'];
$header  = $response->getHeader('X-Custom-Header-Response');
$header  = $response->find('headers.x-custom-header-response', 'default-value', 'trim');

// Get response body
$body = $response->getBody();
$body = $response->body;
$body = $response['body'];

// Parse JSON response (uses JBZoo/Data)
$json = $response->getJSON();
$value = $json->get('key', 'default', 'trim');
$value = $json->find('key.nested', 'default', 'trim');
```

Parallel Requests
-----------------

[](#parallel-requests)

```
use JBZoo\HttpClient\HttpClient;

$httpClient = new HttpClient();

$results = $httpClient->multiRequest(array(
    'request_0' => 'http://mockbin.org/request',

    'request_1' => ['http://mockbin.org/request', [
        'args' => ['key' => 'value']
    ]],

    'request_2' => ['http://mockbin.org/request', [
        'method' => 'post',
        'args'   => ['key' => 'value'],
        'headers'         => [
            'X-Custom-Header' => 42,
        ],
        'timeout'         => 10,
        'verify'          => false,
        'exceptions'      => false,
        'allow_redirects' => true,
        'max_redirects'   => 10,
        'user_agent'      => 'JBZoo/Http-Client v1.x-dev'
    ]]
]);

$results['request_0']->getBody();
$results['request_1']->getBody();
$results['request_2']->getBody();
```

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
make update          # Install/update dependencies
make test-all        # Run tests and code style checks
make test            # Run PHPUnit tests only
make codestyle       # Run code style checks only
```

### Mock Server

[](#mock-server)

For testing purposes, you can start a mock HTTP server:

```
make start-mock-server  # Starts httpbin on port 8087
```

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

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Run tests (`make test-all`)
4. Commit your changes (`git commit -am 'Add amazing feature'`)
5. Push to the branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request

License
-------

[](#license)

MIT - see [LICENSE](LICENSE) file for details.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance63

Regular maintenance activity

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.3% 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 ~128 days

Recently: every ~353 days

Total

27

Last Release

224d ago

Major Versions

1.2.1 → 2.0.02019-11-24

2.1.0 → 3.0.02020-07-14

3.6.2 → 4.0.02022-06-06

4.0.0 → 7.0.02023-07-09

PHP version history (8 changes)1.0.0PHP &gt;=5.3

1.2.1PHP &gt;=7.0

2.0.0PHP &gt;=7.1

3.0.0PHP &gt;=7.2

3.0.1PHP ^7.2

4.0.0PHP &gt;=7.4

7.0.0PHP ^8.1

7.1.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e6de2785f6d099699f430ff58404af4fc0e83060d2953028c9664a54704a5f?d=identicon)[smetdenis](/maintainers/smetdenis)

---

Top Contributors

[![SmetDenis](https://avatars.githubusercontent.com/u/1118678?v=4)](https://github.com/SmetDenis "SmetDenis (101 commits)")[![CB9TOIIIA](https://avatars.githubusercontent.com/u/1074710?v=4)](https://github.com/CB9TOIIIA "CB9TOIIIA (5 commits)")

---

Tags

guzzlehttphttp-clienthttp-requestsjbzoormccuehttprequesthttpsclientcurlGuzzleguzzlehttprequestsrmccue

### Embed Badge

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

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

###  Alternatives

[swlib/saber

Swoole coroutine HTTP client

985145.0k27](/packages/swlib-saber)[aplus/http-client

Aplus Framework HTTP Client Library

2161.6M1](/packages/aplus-http-client)[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.2k3](/packages/pdeans-http)[opgg/riotquest

RiotQuest, PHP RiotAPI client library that focused on multi request from OP.GG

172.6k](/packages/opgg-riotquest)

PHPackages © 2026

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