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

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

easyph/tp6-auth
===============

auth package for thinkphp6

01PHP

Since Jul 2Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

think-addons
============

[](#think-addons)

The ThinkPHP6 Auth Package

安装
--

[](#安装)

> composer require easyph/tp6-auth

配置
--

[](#配置)

### 公共配置

[](#公共配置)

```
// auth配置
'auth'  => [
    'auth_on'           => 1, // 权限开关
    'auth_type'         => 1, // 认证方式，1为实时认证；2为登录认证。
    'auth_group'        => 'auth_group', // 用户组数据不带前缀表名
    'auth_group_access' => 'auth_group_access', // 用户-用户组关系不带前缀表名
    'auth_rule'         => 'auth_rule', // 权限规则不带前缀表名
    'auth_user'         => 'member', // 用户信息不带前缀表名
],

```

### 导入数据表

[](#导入数据表)

> `think_` 为自定义的数据表前缀

```
------------------------------
-- think_auth_rule，规则表，
-- id:主键，name：规则唯一标识, title：规则中文名称 status 状态：为1正常，为0禁用，condition：规则表达式，为空表示存在就验证，不为空表示按照条件验证
------------------------------
 DROP TABLE IF EXISTS `think_auth_rule`;

CREATE TABLE `think_auth_rule` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` char(80) NOT NULL DEFAULT '' COMMENT '规则唯一标识',
  `title` char(20) NOT NULL DEFAULT '' COMMENT '规则中文名称',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '在think_auth_rule 表中定义一条规则时，如果type为1， condition字段就可以定义规则表达式。 如定义{score}>5  and {score}
