PHP code example of chumoe / jwt

1. Go to this page and download the library: Download chumoe/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/ */

    

chumoe / jwt example snippets


use chumoe\jwt\JwtToken;

$user = [
    'uid'  => 2022,
    'name'  => 'chumoe',
    'email' => '[email protected]'
];
$token = JwtToken::generateToken($user);
var_dump(json_encode($token));

$uid = JwtToken::getCurrentId();

$email = JwtToken::getExtend();

$email = JwtToken::getExtendVal('email');

$refreshToken = JwtToken::refreshToken();

$exp = JwtToken::getTokenExp();

ssh-keygen -t rsa -b 4096 -E SHA512 -m PEM -P "" -f RS512.key
openssl rsa -in RS512.key -pubout -outform PEM -out RS512.key.pub

ssh-keygen -t rsa -b 4096 -E SHA354 -m PEM -P "" -f RS384.key
openssl rsa -in RS384.key -pubout -outform PEM -out RS384.key.pub

ssh-keygen -t rsa -b 4096 -E SHA256 -m PEM -P "" -f RS256.key
openssl rsa -in RS256.key -pubout -outform PEM -out RS256.key.pub