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

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

mhhex/http-curl
===============

v1.0.0(1y ago)02Apache-2.0PHP

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mhhex/http-curl)[ Packagist](https://packagist.org/packages/mhhex/http-curl)[ RSS](/packages/mhhex-http-curl/feed)WikiDiscussions master Synced 1mo ago

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

http-curl
=========

[](#http-curl)

适用于 thinkphp &gt;= 6.0.0 的网络操作类库

主要特性
----

[](#主要特性)

- 轻量级
- 支持链写法
- 灵活请求配置
- 可选安全配置
- 灵活响应处理

安装
--

[](#安装)

```
composer require mhhex/http-curl
```

使用文档
----

[](#使用文档)

### 声明

[](#声明)

```
use mhhex\HttpCurl;
```

### 示例

[](#示例)

```
// 创建HttpCurl类的实例
$httpCurl = new HttpCurl();

// 使用链式写法依次设置请求的URL、数据、方法、请求头以及Cookie等信息，并发送请求
$result = $httpCurl
    ->setUrl('https://api.example.com/users') // 设置请求的URL
    ->setData(['name' => 'John', 'age' => 30]) // 设置要发送的数据（这里模拟发送用户信息）
    ->setMethod('POST') // 设置请求方法为POST
    ->setHeader('Content-Type', 'application/json') // 设置请求头，表明发送的数据是JSON格式
    ->setHeader('Authorization', 'Bearer your_token_here') // 设置授权头，这里替换为真实的授权token
    ->setCookie('prev_session_id=12345') // 设置请求的Cookie信息（示例Cookie，可按需替换）
    ->send(); // 发送请求

// 根据send方法的返回类型（可能是数组或者原始字符串）进行相应处理
if (is_array($result)) {
    // 如果返回的是数组，通常意味着是JSON解析后的结果，这里可以进行具体业务逻辑操作，比如提取数据等
    echo "返回的是JSON解析后的数组，以下是部分数据示例：";
    echo "用户名: ". $result['name']. "";
    echo "年龄: ". $result['age'];
} else {
    // 如果返回的是原始字符串，可能是其他格式的数据，比如HTML等，可按需输出查看等
    echo "返回的是原始字符串内容：". $result;
}
```

版权信息
----

[](#版权信息)

http-curl遵循Apache2开源协议发布，并提供免费使用。

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance45

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

433d ago

### Community

Maintainers

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

---

Top Contributors

[![Lh977177](https://avatars.githubusercontent.com/u/102611463?v=4)](https://github.com/Lh977177 "Lh977177 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

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

2.8k73.3M317](/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)[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)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M383](/packages/php-http-curl-client)

PHPackages © 2026

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