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

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

yangguanghui/g-http
===================

Simple Http client base on GuzzleHttp

V1.7.3(4y ago)081MITPHP

Since Jun 9Pushed 4y agoCompare

[ Source](https://github.com/yangguanghui/GHttp)[ Packagist](https://packagist.org/packages/yangguanghui/g-http)[ RSS](/packages/yangguanghui-g-http/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (13)Used By (1)

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 PHP-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 adapter:

```
composer require cache/predis-adapter

```

Usage:

```
use Jaeger\GHttp;
use Cache\Adapter\Predis\PredisCachePool;

$client = new \Predis\Client('tcp:/127.0.0.1:6379');
$pool = new PredisCachePool($client);

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~160 days

Recently: every ~303 days

Total

12

Last Release

1493d ago

### Community

Maintainers

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

---

Top Contributors

[![jae-jae](https://avatars.githubusercontent.com/u/5620429?v=4)](https://github.com/jae-jae "jae-jae (15 commits)")[![yangguanghui](https://avatars.githubusercontent.com/u/8952425?v=4)](https://github.com/yangguanghui "yangguanghui (3 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/yangguanghui-g-http/health.svg)

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

###  Alternatives

[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[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)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client-php

Documentation for all of Ory Hydra's APIs.

1710.8k](/packages/ory-hydra-client-php)

PHPackages © 2026

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