PHP code example of geraint / php-simple-jwt
1. Go to this page and download the library: Download geraint/php-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/ */
geraint / php-simple-jwt example snippets
hpSimpleJwt\Rs256Jwt;
$privateKey = file_get_contents(__DIR__ . '/../tests/private_key.pem');
assert(is_string($privateKey));
$jwt = new Rs256Jwt(
[
'alg' => 'RS256',
'typ' => 'JWT',
],
[
'name' => 'Joe Bloggs',
],
$privateKey
);
$signedToken = $jwt->getSignedToken();
echo "{$signedToken}\n";