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

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

anxu/http-client
================

Lightweight http client

v1.0(7y ago)09MITPHPPHP &gt;=5.3

Since Jun 28Pushed 7y agoCompare

[ Source](https://github.com/anxu1212/HttpClient)[ Packagist](https://packagist.org/packages/anxu/http-client)[ RSS](/packages/anxu-http-client/feed)WikiDiscussions master Synced 2w ago

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

HttpClient
==========

[](#httpclient)

#### 介绍

[](#介绍)

轻量级 http client

#### 目录结构

[](#目录结构)

```
├─src                   代码目录
│  ├─Client.php           Http Client
│  ├─ClientRequest.php    Request类
│  └─ClientResponse.php   Response类
│
├─tests                   测试代码
├─composer.json           composer.json
├─phpunit.xml.dist        测试配置
└─README.md               README.md

```

#### 安装教程

[](#安装教程)

```
composer require --prefer-dist anxu/http-client "*"

```

#### 使用说明

[](#使用说明)

```
$client = new Client([
    'Content-type' => 'application/json' //The global header
]);

$response = $client->get('http://xxxxx.com', [
    'key' => 'value' ////The url parameters
],[
    'key'=>'value' //Set request http headers
]);

// $response = $client->post('http://xxxxx.com', [
//     'key' => 'value'   //The url parameters
// ],json_encode([  ////Set http body
//     'id'=>1,
//     'name'=>'test'
// ]), [
//     'key'=>'value' //Set request http headers
// ]);

//Response status
var_dump($response->getStatus());
//200

//Response Headers
var_dump($response->getHeaders());
// array(2) {
//     ["Set-Cookie"]=> array(2) {
//         [0]=> string(8) "SESSIONID=d98aa7fe2dd4a8b0111374f84ca3941e",
//         [1]=> string(8) "id=941e"
//     }
//     ["Content-Type"]=> array(1) {
//         [0]=> string(9) "text/html"
//     }
// }

//The specified response header
var_dump($response->getHeader('Set-Cookie'));
//string(8) "SESSIONID=d98aa7fe2dd4a8b0111374f84ca3941e"

var_dump($response->getHeader('Set-Cookie', false));
//array(2) {
//    [0]=> string(8) "SESSIONID=d98aa7fe2dd4a8b0111374f84ca3941e",
//    [1]=> string(8) "id=941e"
//}

//Response body
echo $response->getContent();
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2559d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5273409?v=4)[Vu Pham](/maintainers/anxu)[@Anxu](https://github.com/Anxu)

---

Top Contributors

[![anxu1212](https://avatars.githubusercontent.com/u/13920119?v=4)](https://github.com/anxu1212 "anxu1212 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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.6k](/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)
