PHPackages                             jaeger/g-http - 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. jaeger/g-http

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

jaeger/g-http
=============

Simple Http client base on GuzzleHttp

V2.0.1(2y ago)21604.7k↑139.8%7[1 PRs](https://github.com/jae-jae/GHttp/pulls)11MITPHPPHP &gt;=8.1

Since Jun 9Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/jae-jae/GHttp)[ Packagist](https://packagist.org/packages/jaeger/g-http)[ RSS](/packages/jaeger-g-http/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (3)Versions (17)Used By (11)

GHttp
=====

[](#ghttp)

基于GuzzleHttp的简单版Http客户端。 Simple Http client base on GuzzleHttp

安装
--

[](#安装)

```
composer require jaeger/g-http

```

用法
--

[](#用法)

#### 1. get / getJson

[](#1-get--getjson)

```
use Jaeger\GHttp;

$rt = GHttp::get('https://www.baidu.com/s?wd=QueryList');

$rt = GHttp::get('https://www.baidu.com/s','wd=QueryList&wd2=teststr');

//or

$rt = GHttp::get('https://www.baidu.com/s',[
    'wd' => 'QueryList',
    'wd2' => 'teststr'
]);

//opt

$rt = GHttp::get('https://www.baidu.com/s',[
    'wd' => 'QueryList'
],[
    'headers' => [
        'referer' => 'https://baidu.com',
        'User-Agent' => 'Mozilla/5.0 (Windows NTChrome/58.0.3029.110 Safari/537.36',
        'Cookie' => 'cookie xxx'
    ]
]);

$rt = GHttp::getJson('https://xxxx.com/json');
```

#### 2.post / postRaw / postJson

[](#2post--postraw--postjson)

```
$rt = GHttp::post('https://www.posttestserver.com/post.php',[
    'name' => 'QueryList',
    'password' => 'ql'
]);

$rt = GHttp::post('https://www.posttestserver.com/post.php','name=QueryList&password=ql');

$rt = GHttp::postRaw('http://httpbin.org/post','raw data');
$rt = GHttp::postRaw('http://httpbin.org/post',['aa' => 11,'bb' => 22]);

$rt = GHttp::postJson('http://httpbin.org/post',['aa' => 11,'bb' => 22]);
$rt = GHttp::postJson('http://httpbin.org/post','aa=11&bb=22');
```

#### 3.download

[](#3download)

```
GHttp::download('http://sw.bos.baidu.com/setup.exe','./path/to/xx.exe');
```

### 4. concurrent requests

[](#4-concurrent-requests)

```
use Jaeger\GHttp;

$urls = [
    'http://httpbin.org/get?name=php',
    'http://httpbin.org/get?name=go',
    'http://httpbin.org/get?name=c#',
    'http://httpbin.org/get?name=java'
];

GHttp::multiRequest($urls)->withHeaders([
    'X-Powered-By' => 'Jaeger'
])->withOptions([
    'timeout' => 10
])->concurrency(2)->success(function($response,$index){
    print_r((String)$response->getBody());
    print_r($index);
})->error(function($reason,$index){
    print_r($reason);
})->get();
```

```
use Jaeger\GHttp;
use GuzzleHttp\Psr7\Request;

$requests = [
    new Request('POST','http://httpbin.org/post',[
        'Content-Type' => 'application/x-www-form-urlencoded',
        'User-Agent' => 'g-http'
    ],http_build_query([
        'name' => 'php'
    ])),
    new Request('POST','http://httpbin.org/post',[
        'Content-Type' => 'application/x-www-form-urlencoded',
        'User-Agent' => 'g-http'
    ],http_build_query([
        'name' => 'go'
    ])),
    new Request('POST','http://httpbin.org/post',[
        'Content-Type' => 'application/x-www-form-urlencoded',
        'User-Agent' => 'g-http'
    ],http_build_query([
        'name' => 'c#'
    ]))
];

GHttp::multiRequest($requests)->success(function($response,$index){
    print_r((String)$response->getBody());
    print_r($index);
})->post();
```

### 5. Request with cache

[](#5-request-with-cache)

Base on Symfony-Cache:

- Use filesystem cache

```
use Jaeger\GHttp;

$rt = GHttp::get('http://httpbin.org/get',[
    'wd' => 'QueryList'
],[
    'cache' => __DIR__,
    'cache_ttl' => 120 //seconds
]);
```

- Use predis cache

Install predis:

```
composer require predis/predis

```

Usage:

```
use Jaeger\GHttp;
use Symfony\Component\Cache\Adapter\RedisAdapter;

$cache = new RedisAdapter(

    // the object that stores a valid connection to your Redis system
    $redis = RedisAdapter::createConnection(
        'redis://localhost'
    ),

    // the string prefixed to the keys of the items stored in this cache
    $namespace = 'cache',

    // the default lifetime (in seconds) for cache items that do not define their
    // own lifetime, with a value 0 causing items to be stored indefinitely (i.e.
    // until RedisAdapter::clear() is invoked or the server(s) are purged)
    $defaultLifetime = 0
);

$rt = GHttp::get('http://httpbin.org/get',[
    'wd' => 'QueryList'
],[
    'cache' => $cache,
    'cache_ttl' => 120
]);

print_r($rt);
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance51

Moderate activity, may be stable

Popularity46

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90% 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 ~197 days

Recently: every ~332 days

Total

14

Last Release

740d ago

Major Versions

V1.7.3 → V2.0.02024-04-30

PHP version history (2 changes)V2.0.0PHP &gt;=8.0

V2.0.1PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![jae-jae](https://avatars.githubusercontent.com/u/5620429?v=4)](https://github.com/jae-jae "jae-jae (18 commits)")[![huangjie-dd](https://avatars.githubusercontent.com/u/69784661?v=4)](https://github.com/huangjie-dd "huangjie-dd (2 commits)")

### Embed Badge

![Health badge](/badges/jaeger-g-http/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M517](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)[whatsdiff/whatsdiff

See what's changed in your project's dependencies

761.1k](/packages/whatsdiff-whatsdiff)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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