PHPackages                             cexll/hyperf-apihash - 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. [Security](/categories/security)
4. /
5. cexll/hyperf-apihash

ActiveProject[Security](/categories/security)

cexll/hyperf-apihash
====================

API Response Body Hash In (RSA AND AES)

1.0.1(4y ago)18MITPHPPHP &gt;=7.2

Since Jun 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/cexll/hyperf-apihash)[ Packagist](https://packagist.org/packages/cexll/hyperf-apihash)[ RSS](/packages/cexll-hyperf-apihash/feed)WikiDiscussions main Synced 1mo ago

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

Hyperf-ApiHash
==============

[](#hyperf-apihash)

> 为 hyperf 实现的api加密包

对api返回内容进行加密, 区别与常规加密, 使用rsa+aes进行组合加密, 安全性更高

Run
===

[](#run)

```
class IndexController
{
    public function index()
    {
        $cert_path = [
            'public' => BASE_PATH . '/config/cert/public.key',
            'private' => BASE_PATH . '/config/cert/private.pem',
        ];
        // 1. 生成RSA证书 已经生成的可以不用生成, 只需要配置好路径即可
        // 2. 实例化 ApiHash
        // 3. 选择加密 公钥加密 或 私钥加密 将加密后的body 直接返回即可, 加密后的内容为
        // [
        //  body 为apibody
        //  key  为加密key
        //  ]
        // 4. 解密
        //  解密步骤 1. 通过RSA解密key得到用于加密aes的key, 使用解密后的key, 来解密aes, 例 rsa->decrypt(证书, key) -> key 得到解密后的key, aes->decrypt(body, key) -> body, 得到正常要返回的api body
        $apihash  = new ApiHash();
        $data = '123123123123123123';
        $body = $apihash->privateHash($data, $cert_path['private']);
        $decrypt = $apihash->publicDecrypt($body, $cert_path['public']);
        return $this->response->json([
            'body' => $body,
            'decrypt' => $decrypt
        ]);
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

2

Last Release

1788d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3af05f48f3e1a98ef4811a9055b6e64af52f32427256acb814ca6dea21a759fa?d=identicon)[cexll](/maintainers/cexll)

---

Top Contributors

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

---

Tags

phphyperfapihash

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/cexll-hyperf-apihash/health.svg)

```
[![Health](https://phpackages.com/badges/cexll-hyperf-apihash/health.svg)](https://phpackages.com/packages/cexll-hyperf-apihash)
```

###  Alternatives

[hyperf-ext/hashing

The Hyperf Hashing package.

1588.4k5](/packages/hyperf-ext-hashing)

PHPackages © 2026

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