PHPackages                             hdb/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. hdb/auth

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

hdb/auth
========

authTest

v1.1(7y ago)014PHP

Since Sep 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hdebiao/auth)[ Packagist](https://packagist.org/packages/hdb/auth)[ RSS](/packages/hdb-auth/feed)WikiDiscussions master Synced 4d ago

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

auth
====

[](#auth)

auth权限认证

说明:
---

[](#说明)

auth权限验证类使用到三张数据表:auth\_user,auth\_group,auth\_rule,它们的作用分别为: auth\_user:用户数据表 auth\_group:用户组别表,用于保存用户属于哪一个组的数据 auth\_rule:用户规则表,用于保存组别和规则的数据

```
create table auth_user
(
  id     int(11) unsigned auto_increment
    primary key,
  name   varchar(80) default ''  not null
  comment '用户名',
  groups varchar(255) default '' not null
  comment '所属组别',
  constraint name
  unique (name)
)
  charset = utf8;
```

```
create table auth_group
(
  id     mediumint unsigned auto_increment
    primary key,
  name   char(100) default ''   not null
  comment '组名',
  status tinyint(1) default '1' not null
  comment '是否生效',
  rules  char(255) default ''   not null
  comment '拥有的规则'
)
  charset = utf8;
```

```
create table auth_rule
(
  id          int(11) unsigned auto_increment
    primary key,
  name        varchar(80) default ''       not null
  comment '规则名称',
  title       varchar(100) default ''      not null
  comment '规则说明',
  creatUserId int(11) unsigned default '0' not null
  comment '创建人id',
  status      tinyint(1) default '1'       not null
  comment '是否生效',
  constraint name
  unique (name)
)
  charset = utf8;
```

使用方法
----

[](#使用方法)

1. 引入自动加载文件
2. 配置数据库信息
3. 实例化类,传入规则名称和用户uid即可验证规则

```
require_once './vendor/autoload.php';

use Hdb\Auth\Auth;

$dataConfig = array(
    'host' => 'localhost',
    'user' => 'root',
    'password' => '1122',
    'port' => 3306,
    'database' => 'auth'
);

$auth = new Auth($dataConfig);

$checkRule= $auth->checkRule('checkProject', 2);

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

2802d ago

Major Versions

v0.2 → v1.02018-09-13

### Community

Maintainers

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

---

Top Contributors

[![hdebiao](https://avatars.githubusercontent.com/u/13990350?v=4)](https://github.com/hdebiao "hdebiao (6 commits)")

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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