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

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

nbczwphp/think-auth
===================

auth package for thinkphp5

v1.0.0(5y ago)03Apache-2.0PHPPHP &gt;=5.4.0CI failing

Since Jul 17Pushed 5y agoCompare

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

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

功能级权限
=====

[](#功能级权限)

The ThinkPHP5 Auth Package

安装
--

[](#安装)

> composer require nbczwphp/think-auth

权限认证类
-----

[](#权限认证类)

功能特性：

1. 是对规则进行认证，不是对节点进行认证。用户可以把节点当作规则名称实现对节点进行认证。 $auth=new Auth(); $auth-&gt;check('规则名称','用户id')
2. 可以同时对多条规则进行认证，并设置多条规则的关系（or或者and） $auth=new Auth(); $auth-&gt;check('规则1,规则2','用户id','and') 第三个参数为and时表示，用户需要同时具有规则1和规则2的权限。 当第三个参数为or时，表示用户值需要具备其中一个条件即可。默认为or
3. 一个用户可以属于多个用户组(think\_auth\_group\_access表 定义了用户所属用户组)。我们需要设置每个用户组拥有哪些规则(think\_auth\_group 定义了用户组权限)
4. 支持规则表达式。 在think\_auth\_rule 表中定义一条规则时，如果type为1， condition字段就可以定义规则表达式。 如定义{score}&gt;5 and {score}&lt;100 表示用户的分数在5-100之间时这条规则才会通过。

配置
--

[](#配置)

项目配置键为`auth_config`

```
'auth_on'           => true,                      // 认证开关
'auth_type'         => 1,                         // 认证方式，1为实时认证；2为登录认证。
'auth_group'        => '__AUTH_GROUP__',        // 用户组数据表名
'auth_group_access' => '__AUTH_GROUP_ACCESS__', // 用户-用户组关系表
'auth_rule'         => '__AUTH_RULE__',         // 权限规则表
'auth_user'         => '__USER__'             // 用户信息表

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

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

Unknown

Total

1

Last Release

2131d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8aebdd5b1d53d518cefaa8e960a8cee8b4985d8755a4b051a6265a162e49810?d=identicon)[nbczw8750](/maintainers/nbczw8750)

---

Top Contributors

[![nbczw8750](https://avatars.githubusercontent.com/u/299441?v=4)](https://github.com/nbczw8750 "nbczw8750 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/nbczwphp-think-auth/health.svg)](https://phpackages.com/packages/nbczwphp-think-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)
