PHPackages                             saopanda/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. saopanda/client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

saopanda/client
===============

简单的请求类

v2.2(5y ago)020mitPHPPHP &gt;=7.1.3

Since Dec 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Saopanda/simpleRequest)[ Packagist](https://packagist.org/packages/saopanda/client)[ RSS](/packages/saopanda-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)DependenciesVersions (4)Used By (0)

simpleRequest
=============

[](#simplerequest)

简单、正经、好用的请求类

实例化
---

[](#实例化)

```
use saopanda\client;

$client = client::new();
//  or
$client = client::new([
    'timeout'=>'10',
    'VERIFYHOST'=>true,
    'VERIFYPEER'=>true
]);

```

内容返回
----

[](#内容返回)

成功

> result 为业务返回，errcode 为0

```
[
    "result"  => '业务返回内容',
    "errmsg"  => "",
    "errcode" => 0
]

```

失败

> result 为false

```
[
    "result"  => false,
    "errmsg"  => "Could not resolve host: qqq.com",
    "errcode" => 6
]

```

配置选项
----

[](#配置选项)

在实例化之后，get()、post() 方法之前 使用如下方法设置

### 设置 POST数据：urlEncoded

[](#设置-post数据urlencoded)

```
$client->urlEncodedData([...]);

```

### 设置 POST数据：formData

[](#设置-post数据formdata)

```
$client->formData([...]);

```

### 设置 POST数据：json

[](#设置-post数据json)

```
$client->jsonData([...]);

```

### 设置 POST数据：raw

[](#设置-post数据raw)

```
$client->rawData('...');

```

### 设置 timeout

[](#设置-timeout)

实例化时指定，或

```
$client->timeout(1);

```

### 设置 headers

[](#设置-headers)

优先级比 get()、post() 方法内设置 header低，会被替换

```
$client->headers([
    'Authorization: Bearer eyJ0eXAiOiJKV'
]);

```

### 设置 params

[](#设置-params)

优先级比 get()、post() 方法内设置 params低，会被替换

```
$client->params([
    'code'  =>  '081mN10w3FI4yV2QuM2w3b9Npx1mN10u'
])

```

### 设置证书

[](#设置证书)

使用绝对路径

```
$client->pem('xxx.pem');

```

### 设置证书密钥

[](#设置证书密钥)

使用绝对路径

```
$client->pem('xxx.key');

```

链式调用
----

[](#链式调用)

```
$res = $client->timeout(1)
    ->header($headers)
    ->params($params)
    ->get($url);

```

```
$res = $client->headers($headers)
    ->formData($params)
    ->post($url);

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Every ~4 days

Total

3

Last Release

1960d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d60c6b23132aafa2557093dec25bb64b228ada0f64c4e45cc9f6e6b632429e7?d=identicon)[saopanda](/maintainers/saopanda)

---

Top Contributors

[![Saopanda](https://avatars.githubusercontent.com/u/33977628?v=4)](https://github.com/Saopanda "Saopanda (11 commits)")

### Embed Badge

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

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

PHPackages © 2026

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