1. Go to this page and download the library: Download gamegos/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/ */
gamegos / jwt example snippets
$key = 'some-secret-for-hmac';
$alg = 'HS256';
$token = new \Gamegos\JWT\Token();
$token->setClaim('sub', '[email protected]'); // alternatively you can use $token->setSubject('[email protected]') method
$token->setClaim('exp', time() + 60*5);
$encoder = new \Gamegos\JWT\Encoder();
$encoder->encode($token, $key, $alg);
printf("JWT TOKEN: %s\n", $token->getJWT()); //eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzb21lb25lQGV4YW1wbGUuY29tIiwiZXhwIjoxNDA4NDUzNzkwfQ.2Fk5-UUMhOAcQH812LL0sdaf29zuf293nLhHp_VKBDg