PHP code example of yjj / tp-jwt-auth

1. Go to this page and download the library: Download yjj/tp-jwt-auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yjj / tp-jwt-auth example snippets


 thans\jwt\middleware\JWTAuth::class,

use thans\jwt\facade\JWTAuth;

$token = JWTAuth::builder(['uid' => 1]);//参数为用户认证的信息,请自行添加

JWTAuth::auth();//token验证

JWTAuth::refresh();//刷新token,会将旧token加入黑名单
        
shell
$ php think jwt:create