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

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

zodream/http
============

http client

5.3(2y ago)01932MITPHPPHP &gt;=8.2

Since Sep 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/zodream/http)[ Packagist](https://packagist.org/packages/zodream/http)[ Docs](https://github.com/zodream/http)[ RSS](/packages/zodream-http/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (2)

http
====

[](#http)

优雅链式调用API

示例
--

[](#示例)

引用

```
use Zodream\Http\Http;
```

获取指定网址内容

```
(new Http('https://zodream.cn'))->get();
```

传递GET 参数

```
(new Http())->url('https://zodream.cn', [
    'page' => 1
])->get();
```

传递 POST

```
(new Http('https://zodream.cn'))->maps([
    'page' => 1
])->text();
```

高级用法
----

[](#高级用法)

自动进行值的填充

```
(new Http())->url('https://zodream.cn', [
    'keywords'
])->maps([
    'page' => 1,     // 这是使用默认值
    '#url'           // 如果没有会报错
])->parameters([
    'url' => 'aaaa',
    'keywords' => 'q',
    'aa' => 'bb'        // 这个并不会传递过去
])->encode(Http::JSON)->decode(Http::Json)->decode(function($data) {
    $data['a'] = $data['data'];
    return $data;
})->text();
```

相当于

请求

POST {"page":1, "url":"aaaa"}

获取的结果是 {"code":200, "data":"a"}

最后你接收到的是数组

```
[
   'code' => 200,
   'data' => 'a',
   'a'    => 'a'
]
```

值自动匹配
-----

[](#值自动匹配)

```
$data = Http::getMapParameters([
    '#goods_id',              // # 必须有值 否则报错
    'a:f' => [                // 如果 f 有值 传给 a 即 a => 2，如果无值, 进行子匹配  a => [e => 11]
        '#e'
    ],
    [              // 多个里面匹配至少一个
        'b',
        'c',
        'd'
    ],
    'g' => 1                 // 可以设置默认值， 数组不是默认值
], [
    'goods_id' => 1,
    'f' => 2,
    'c' => 4,
    'd' => 7,
    'e' => 11
]);
```

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance59

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 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

Every ~236 days

Recently: every ~324 days

Total

11

Last Release

827d ago

Major Versions

v1.0 → v2.02018-01-24

2.4 → 4.02020-09-06

4.0 → 5.02021-01-04

PHP version history (4 changes)v1.0PHP &gt;=5.6.0

5.0PHP &gt;=8.0

5.2PHP &gt;=8.1

5.3PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![zx648383079](https://avatars.githubusercontent.com/u/9996852?v=4)](https://github.com/zx648383079 "zx648383079 (70 commits)")

---

Tags

http clientzodream

### Embed Badge

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

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

###  Alternatives

[psr/http-client

Common interface for HTTP clients

1.7k731.6M2.8k](/packages/psr-http-client)[kriswallsmith/buzz

Lightweight HTTP client

2.0k32.2M463](/packages/kriswallsmith-buzz)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78127.2M458](/packages/react-http)[smi2/phpclickhouse

PHP ClickHouse Client

84711.1M81](/packages/smi2-phpclickhouse)[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

44512.5M57](/packages/eightpoints-guzzle-bundle)[laminas/laminas-http

Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests

3731.0M310](/packages/laminas-laminas-http)

PHPackages © 2026

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