PHPackages                             caijw/httpclient - 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. caijw/httpclient

ActiveLibrary

caijw/httpclient
================

基于guzzlehttp/guzzle的http client功能

v1.0.0(4y ago)02.5k↓100%PHPPHP &gt;=5.6

Since Feb 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/caijwei/httpclient)[ Packagist](https://packagist.org/packages/caijw/httpclient)[ RSS](/packages/caijw-httpclient/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

用来处理http请求
==========

[](#用来处理http请求)

安装
--

[](#安装)

```
composer require caijw/http

```

使用
--

[](#使用)

```
$client = new \Caijw\HttpClient\Client();
$message = $client->post($url, ['k1' => 'v1', 'k2'=> 'v2']);//使用post提交到某个url上
if ($message === false) {
  $exception = $client->getLastException();//异常
}

```

类方法
---

[](#类方法)

```
/**
 * @param string $url
 * @param array $data
 * @return false|string 如果成功返回字符串，失败返回false，所以要用===来判断
 * @throws SystemException
 */
public function get($url, array $data = array());
public function post($url, array $data = array());

```

特殊情况
----

[](#特殊情况)

默认情况下，连接超时时间为0.4秒，总体请求超时时间为1秒，如果有必要可以通过setOption调整。
一般情况不用处理返回的Response，如果真的需要，可以使用$this-&gt;getLastResponse来获取。如果出现异常，则调用$ex-&gt;getResponse()来获取。
当请求出现问题的时候会在/tmp/目录下生成一个以SE-域名为名字开头的临时文件，当问题消失时文件会被删除（用做监控）

钉钉消息
----

[](#钉钉消息)

```
/**
* $robotCode是机器人码，不是url
* $at 可以传三个值
*   true  : @所有人
*   被@人的手机号列表
*   false : 不@人
*/
$ding = new \Caijw\HttpClient\Ding($robotCode,$at);
$ding->text('content');

```

### 类方法

[](#类方法-1)

```
/**
 * @method bool text(string $content)
 * @method bool link(string $title, string $text, string $messageUrl, string $picUrl)
 * @method bool markdown(string $title, string $text)
 */

```

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

1488d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9bebb2df9f23dad5acf01dd711e9b695b0191ade82b4aa5e0ec0d2dcf131591f?d=identicon)[caijw](/maintainers/caijw)

---

Top Contributors

[![caijwei](https://avatars.githubusercontent.com/u/19322578?v=4)](https://github.com/caijwei "caijwei (10 commits)")

### Embed Badge

![Health badge](/badges/caijw-httpclient/health.svg)

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

PHPackages © 2026

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