PHPackages                             hao/auth - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. hao/auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

hao/auth
========

鉴权处理

1.2(5y ago)07MITPHPPHP &gt;=5.6

Since Jun 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/JZhao1020/auth)[ Packagist](https://packagist.org/packages/hao/auth)[ Docs](https://github.com/JZhao1020/auth)[ RSS](/packages/hao-auth/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

auth
====

[](#auth)

接口鉴权

开源地址
----

[](#开源地址)

\##1.安装

```
composer require hao/auth

```

\##2.实例化

```
$config = [
	// redis配置
    'host'       => '127.0.0.1',
    'port'       => 6379,
    'password'   => '',
    'select'     => 0,
    'timeout'    => 0,
    'expire'     => 0,
    'persistent' => false,
    'prefix'     => '',
    'serialize'  => true,
];
$auth = new \auth\Auth($config);

```

\####redis缓存格式

```
开放平台 - 商户公钥
$key = auth:open_merchant_public_key_xxx （xxx：app_id值）
// 获取公钥内容（仅中间部分）
$public_key = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqW1D7YQPfa2pURezqBbB+Pk9Requx2RP5HV8bl9OBpTMohs5eu/pjCh4UpjlNv75M2v6wuQv6yXUAwYER/jGrFxQVl9rVVegGPHgIbIMTvC8lktIQfe9CURex7vq63oF/GUAWXU+rliE+hg/RcGI53tRRllH7Tt2nB4mKltcpt4OvvaiDeiAZEnBgmgoSpaa3DBazHl1VoBmTvH2jEoo4fH3asQfZbrdf+0IC/zNb0l+QUJTQ7m1M6nvLjXMJGeiqkuAW4szZLLtghUFqqD0uURo5Or9A57Gu7mtNypqRG/7g/qc7/cdrSPzraO2H8RGdU05mg3wsXQCn1rhYiCwXwIDAQAB';
redis()->set($key, $public_key);

商户后台 - token（仅需要校验token的接口）
$key = auth:api_1 (1：用户id)
redis()->set($key, $token);

总后台 - token（仅需要校验token的接口）
$key = auth:admin_1 (1：用户id)
redis()->set($key, $token);

```

\####调用

```
$auth->gateway('api')->check($params);

```

\####返回码

```
code值
200     - 成功
501     - 必填参数异常
505     - 签名失败

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

1864d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22906648?v=4)[hao](/maintainers/JZhao1020)[@JZhao1020](https://github.com/JZhao1020)

---

Top Contributors

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

---

Tags

author

### Embed Badge

![Health badge](/badges/hao-auth/health.svg)

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

###  Alternatives

[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[firemultimedia/mautic-multi-captcha-bundle

This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.

151.3k](/packages/firemultimedia-mautic-multi-captcha-bundle)

PHPackages © 2026

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