PHP code example of coffin-laughter / jwt-auth
1. Go to this page and download the library: Download coffin-laughter/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/ */
coffin-laughter / jwt-auth example snippets
coffin\jwtauth\middleware\JWTAuth::class,
use coffin\jwtauth\facade\JWTAuth;
$token = JWTAuth::builder(['uid' => 1]);//参数为用户认证的信息,请自行添加
JWTAuth::auth();//token验证
JWTAuth::refresh();//刷新token,会将旧token加入黑名单
shell
$ php think jwt:create