PHPackages                             weiki/unifycode\_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. weiki/unifycode\_http

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

weiki/unifycode\_http
=====================

通过一致性代码减少代码变种

v1.0.3(4y ago)111Apache-2.0PHP

Since Dec 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/weiki365/unifycode_http)[ Packagist](https://packagist.org/packages/weiki/unifycode_http)[ RSS](/packages/weiki-unifycode-http/feed)WikiDiscussions master Synced today

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

Unify Code For Http
===================

[](#unify-code-for-http)

统一码
---

[](#统一码)

> 通过一致性代码减少代码变种

### 安装

[](#安装)

> composer require weiki/unifycode\_http

#### 简单使用

[](#简单使用)

```
use Weiki\UnifyCode\Http;

echo Http::HTTP_OK;             // 200
echo Http::ok();                // 200
echo Http::toStatusCode('ok');  // 200
echo Http::toConst('ok');       // HTTP_OK
```

#### 使用管道 `Pipeline` 拦截或加工数据

[](#使用管道-pipeline-拦截或加工数据)

```
use Weiki\UnifyCode\Pipeline;

// 将结果转变为 json 格式
$result = (new Pipeline)->through(function ($data, $next) {
    return toJson([
        'code' => $next($data),
        'message' => '你好，中国',
    ]);
})->ok();

echo $result; // {"code":200,"message":"你好中国"}
```

#### `Pipeline` 支持写法

[](#pipeline-支持写法)

```
use Weiki\UnifyCode\Pipeline;

// 函数模式
$result = (new Pipeline)->through('handle')->ok();

// 匿名函数模式
$result = (new Pipeline)->through(function () {})->ok();

// 静态方法模式
$result = (new Pipeline)->through('class::method')->ok();

// 实例方法模式
$result = (new Pipeline)->through([[$object, "method"]])->ok();

// 多个参数模式
$result = (new Pipeline)->through(
    function ($data, $next) {
        // ...
    },
    function ($data, $next) {
        // ...
    }
)->ok();

// 数组模式
$result = (new Pipeline)->through([
    function ($data, $next) {
        // ...
    },
    function ($data, $next) {
        // ...
    }
])->ok();
```

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

1538d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8afb185381c80b54b52e57427a4a37a2220195145fa0def9c0bd3fac5faee4d3?d=identicon)[weiki365](/maintainers/weiki365)

---

Top Contributors

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

---

Tags

httpcode

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k997.0M2.7k](/packages/guzzlehttp-psr7)[psr/http-message

Common interface for HTTP messages

7.1k1.0B4.8k](/packages/psr-http-message)[psr/http-factory

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

1.9k676.6M1.6k](/packages/psr-http-factory)[psr/http-client

Common interface for HTTP clients

1.7k665.1M1.7k](/packages/psr-http-client)[symfony/http-client

Provides powerful methods to fetch HTTP resources synchronously or asynchronously

2.0k306.4M2.8k](/packages/symfony-http-client)[psr/link

Common interfaces for HTTP links

2.5k141.3M66](/packages/psr-link)

PHPackages © 2026

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