PHP code example of acelan / simple-jwt
1. Go to this page and download the library: Download acelan/simple-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/ */
acelan / simple-jwt example snippets
use AceLan\JWT\JsonWebToken;
$payload = array('sub' => '[email protected]', 'infoData' => ['name' => 'David']);
$token = JWTAuthLibrary::getToken($payload);
print_r($token);
$getPayload = JWTAuthLibrary::verifyToken($token['accessToken']);
$getRrfreshPayload = JWTAuthLibrary::verifyRefreshToken($token['accessToken'], $token['refreshToken']);
echo "<br>";
var_dump($getPayload);
echo "<br>";
var_dump($getRrfreshPayload);