PHP code example of qifen / jwt
1. Go to this page and download the library: Download qifen/jwt 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/ */
qifen / jwt example snippets
use Qifen\Jwt\JwtToken;
$user = [
'id' => 2022,
'name' => 'lei.wang',
'email' => '[email protected]'
];
$accessToken = JwtToken::init()->generateToken($user);
$uid = JwtToken::init()->getCurrentId();
$email = JwtToken::init()->getExtendVal('email');
$accessToken = JwtToken::init()->refreshToken();