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

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

uniondrug/http
==============

Uniondrug Http Component for uniondrug/framework

2.0.1(8y ago)01.5k1MITPHPPHP &gt;=5.6

Since Mar 28Pushed 8y ago3 watchersCompare

[ Source](https://github.com/uniondrug/http)[ Packagist](https://packagist.org/packages/uniondrug/http)[ RSS](/packages/uniondrug-http/feed)WikiDiscussions master Synced 2w ago

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

Uniondrug HTTP Server and Client
================================

[](#uniondrug-http-server-and-client)

> THANKS：本模块来自 [FastD](https://github.com/fastdlabs/http)

简单的 Http 协议组件, 用于解析 Http 请求信息, 实现 PSR-7 标准, **支持 Swoole 扩展**.

以上库可以满足大部分 HTTP 请求处理相关工作, 支持 Swoole 处理, 具体请看项目[Swoole](https://github.com/uniondrug/swoole)。

要求
--

[](#要求)

- php &gt;= 5.6

安装
--

[](#安装)

```
composer require "uniondrug/http" -vvv

```

文档
--

[](#文档)

[文档](docs/readme.md)

使用
--

[](#使用)

HTTP 组件封装了常用的服务端解释,客户端请求,并且友好集成 Swoole Http Server 解析，实现PSR-7。

##### 获取 pathinfo

[](#获取-pathinfo)

```
use Uniondrug\Http\ServerRequest;

$request = ServerRequest::createServerRequestFromGlobals();

$request->getUri()->getPath();
```

##### Swoole Http 服务器

[](#swoole-http-服务器)

```
$http = new swoole_http_server("127.0.0.1", 9501);

$http->on('request', function ($request, $response) {
    $server = SwooleServerRequest::createServerRequestFromSwoole($request);
    $response->end($server->getUri()->getPath());
});

$http->start();
```

##### cURL 请求

[](#curl-请求)

Request 对象内部封装了 cURL 请求, 可以直接通过方法调用

```
$request = new Request('GET', 'https://api.github.com/');

$request->setReferrer('http://example.com/');

$response = $request->send(); // Uniondrug\Http\Response
```

响应内容会通过 `Response` 对象返回。

License MIT
-----------

[](#license-mit)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~3 days

Total

3

Last Release

3010d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/865ceb7d8226574735eab8fc82de9cfbc4a708c291b3c816e75d53944348b686?d=identicon)[wsfuyibing](/maintainers/wsfuyibing)

---

Top Contributors

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

---

Tags

httppsr

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.8k](/packages/guzzlehttp-psr7)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k728.6M2.5k](/packages/psr-http-factory)[psr/http-client

Common interface for HTTP clients

1.7k714.1M2.8k](/packages/psr-http-client)[symfony/psr-http-message-bridge

PSR HTTP message bridge

1.3k312.3M932](/packages/symfony-psr-http-message-bridge)[laminas/laminas-diactoros

PSR HTTP Message implementations

548112.0M1.1k](/packages/laminas-laminas-diactoros)[mezzio/mezzio

PSR-15 Middleware Microframework

3913.8M120](/packages/mezzio-mezzio)

PHPackages © 2026

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