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

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

ppeerit/think-auth
==================

Library for tp5 auth

v1.0.0(9y ago)024Apache-2.0PHPPHP &gt;=5.4.0

Since Nov 6Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ppeerit/think-auth)[ Packagist](https://packagist.org/packages/ppeerit/think-auth)[ Docs](https://github.com/ppeerit/think-auth)[ RSS](/packages/ppeerit-think-auth/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

think-auth
==========

[](#think-auth)

[![GitHub issues](https://camo.githubusercontent.com/9709b5e5682f95f95ed48adf92c3f98ed24a45ef11eaae4e31b2793b8041d870/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f707065657269742f7468696e6b2d617574682e737667)](https://github.com/ppeerit/think-auth/issues)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/ppeerit/think-auth/master/LICENSE)[![Downloads](https://camo.githubusercontent.com/35decd37e84948cb1293db89abda775d7cc0831023d008d23545025df236e9a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f707065657269742f7468696e6b2d617574682f6c61746573742f746f74616c2e737667)](https://packagist.org/packages/ppeerit/think-auth)

ppeerit\\think-auth 是基于thinkphp5的简单的权限管理扩展包

\##安装

```
composer require ppeerit\think-auth
```

\##配置 扩展配置目录中新增配置文件auth.php

```
return [
	'auth_on' => true, // 认证开关
	'auth_type' => 1, // 认证方式，1为实时认证；2为登录认证。
	'auth_group' => 'auth_group', // 权限组数据表名
	'auth_group_access' => 'auth_group_access', // 用户-用户组关系表
	'auth_rule' => 'auth_rule', // 权限规则表
	'auth_user' => 'member', // 需要授权组的信息表
	'auth_pk' => 'id', // 需要授权组信息表主键
];
```

\##创建数据库 权限规则表

```
-- ----------------------------
-- id:主键，
-- name：规则唯一标识,
-- title：规则中文名称
-- status：状态：为1正常，为0禁用
-- condition：规则表达式，为空表示存在就验证，不为空表示按照条件验证
-- 规则附加条件,满足附加条件的规则,才认为是有效的规则
-- ----------------------------
DROP TABLE IF EXISTS `member_rule`;
CREATE TABLE `member_rule` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` char(80) NOT NULL DEFAULT '',
`title` char(20) NOT NULL DEFAULT '',
`type` tinyint(1) NOT NULL DEFAULT '1',
`status` tinyint(1) NOT NULL DEFAULT '1',
`condition` char(100) NOT NULL DEFAULT '',
`create_time` int(10) NOT NULL DEFAULT '0',
`update_time` int(10) NOT NULL DEFAULT '0',
`delete_time` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) DEFAULT CHARSET=utf8;
-- ----------------------------
```

用户组表

```
-- ----------------------------
-- member_group 需要授权组的表，
-- id：主键， title:用户组中文名称
-- rules：用户组拥有的规则id， 多个规则","隔开
-- status 状态：为1正常，为0禁用
-- ----------------------------
DROP TABLE IF EXISTS `member_group`;
CREATE TABLE `member_group` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`title` char(100) NOT NULL DEFAULT '',
`status` tinyint(1) NOT NULL DEFAULT '1',
`rules` char(80) NOT NULL DEFAULT '',
`create_time` int(10) NOT NULL DEFAULT '0',
`update_time` int(10) NOT NULL DEFAULT '0',
`delete_time` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
```

用户-用户组关系表

```
-- ----------------------------
-- member_group_access 用户组明细表
-- authid:需要授权的id
-- group_id：权限组id
-- ----------------------------
DROP TABLE IF EXISTS `member_group_access`;
CREATE TABLE `member_group_access` (
`authid` mediumint(8) unsigned NOT NULL,
`group_id` mediumint(8) unsigned NOT NULL,
`create_time` int(10) NOT NULL DEFAULT '0',
`update_time` int(10) NOT NULL DEFAULT '0',
`delete_time` int(10) DEFAULT NULL,
UNIQUE KEY `authid_group_id` (`authid`,`group_id`),
KEY `authid` (`authid`),
KEY `group_id` (`group_id`)
) DEFAULT CHARSET=utf8;
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3523d ago

### Community

Maintainers

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

---

Top Contributors

[![czewail](https://avatars.githubusercontent.com/u/14213748?v=4)](https://github.com/czewail "czewail (5 commits)")

---

Tags

auth

### Embed Badge

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

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k50.9M364](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.7k143.0M274](/packages/league-oauth2-server)[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k17.8M59](/packages/lab404-laravel-impersonate)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40921.3M85](/packages/auth0-auth0-php)[kreait/firebase-tokens

A library to work with Firebase tokens

23943.8M18](/packages/kreait-firebase-tokens)

PHPackages © 2026

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