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(6y ago)09MITPHPPHP &gt;=5.3

Since Jun 28Pushed 6y agoCompare

[ Source](https://github.com/anxu1212/HttpClient)[ Packagist](https://packagist.org/packages/anxu/http-client)[ RSS](/packages/anxu-http-client/feed)WikiDiscussions master Synced 2d 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 27% 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

2512d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cc928d4a136fa896226e760d2ed271477ac353a20a4ee930bd44d2608ccaf19?d=identicon)[anxu](/maintainers/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

[friendsofsymfony/rest-bundle

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

2.8k73.3M319](/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.8M293](/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)
