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. hao/auth

ActiveLibrary

hao/auth
========

鉴权处理

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

Since Jun 8Pushed 4y 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 today

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 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

1727d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/150cac62db0286325a8ed8971fb217d79b30f89e3087efd17a0d47863b3a7ab0?d=identicon)[JZhao1020](/maintainers/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

[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9125.3k3](/packages/cybercog-laravel-ownership)[silverstripe/multiuser-editing-alert

A module that indicates when people are editing the same page in the CMS

1530.3k1](/packages/silverstripe-multiuser-editing-alert)[breadlesscode/neos-blog

Ready to use blog package

161.4k](/packages/breadlesscode-neos-blog)

PHPackages © 2026

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