PHPackages                             how-name/apisecret - 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. how-name/apisecret

ActiveLibrary[Security](/categories/security)

how-name/apisecret
==================

the api security

461PHP

Since Jul 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/HowName/apisecret)[ Packagist](https://packagist.org/packages/how-name/apisecret)[ RSS](/packages/how-name-apisecret/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

apisecret
=========

[](#apisecret)

api请求加密安全工具类,包含生成签名，检查签名

composer安装
==========

[](#composer安装)

```
composer require how-name/apisecret

```

文件详解
----

[](#文件详解)

- ApiSignatureTrait.php

    生成签名类,将请求参数按字典排序后拼接secret后sha1加密生成签名，可额外自定义加密算法
- ConsumeApiSignatureUtil.php

    检查Signature类，验证方使用
- ProduceApiSignatureUtil.php

    生产组装api请求参数工具类，请求方使用，secret不可外泄，即使加密算法被破解，api也是安全的

使用方法
----

[](#使用方法)

```
//生成请求参数
$requestParam = ProduceApiSignatureUtil::build(['user'=>'abc','pass'=>'abc']);

----------------------------------------------

//验证请求参数
$checkStatus = ConsumeApiSignatureUtil::checkSignature($_POST);

if(is_string($checkStatus)){
    //失败
}else{
    //成功
}
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6af5853b5e3481190a702bfe981c3a7d7750fb7c685c2e7b57d58c3c09ab4162?d=identicon)[HowName](/maintainers/HowName)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/how-name-apisecret/health.svg)

```
[![Health](https://phpackages.com/badges/how-name-apisecret/health.svg)](https://phpackages.com/packages/how-name-apisecret)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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