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

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

cncoders/thinkphp-auth
======================

a simple api auth with thinkphp6

1.0.5(6y ago)2223911MITPHPPHP &gt;=5.6CI failing

Since Oct 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cncoders/thinkphp-auth)[ Packagist](https://packagist.org/packages/cncoders/thinkphp-auth)[ Docs](https://github.com/cncoders/thinkphp-auth.git)[ RSS](/packages/cncoders-thinkphp-auth/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

thinkphp-auth
=============

[](#thinkphp-auth)

基于thinkphp6开发的一个JWT权限验证插件

使用方法
====

[](#使用方法)

### 1. 安装

[](#1-安装)

```
composer require cncoders/thinkphp-auth *

```

### 2. 配置文件

[](#2-配置文件)

将安装包内的config/jwt.php复制到thinkphp配置目录

### 3. 异常处理

[](#3-异常处理)

如果需要对异常处理成JSON接口可用的格式可以在app\\ExceptionHandle.php增加相应的异常处理示例如下：

```

if ($e instanceof AutherException) {
	exit( json_encode(['code' => $e->getCode(), 'message' => $e->getMessage()]) );
}

```

### 4.使用示例：

[](#4使用示例)

路由使用 单独使用版本判断可以不用配置jwt

版本判断不支持路由缓存

```
