1. Go to this page and download the library: Download morozovsk/simplejwt 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/ */
morozovsk / simplejwt example snippets
$set = new SimpleJWT\Keys\KeySet();
$set->load(file_get_contents('private.json'));
$set = new SimpleJWT\Keys\KeySet();
// JWK format
$key = new SimpleJWT\Keys\RSAKey(file_get_contents('jwk.json'), 'json');
// PEM format - note raw key only, no X.509 certificates
$key = new SimpleJWT\Keys\RSAKey(file_get_contents('rsa.pem'), 'pem');
$set->add($key);
$set = SimpleJWT\Keys\KeySet::createFromSecret('secret123');
// The above is a shortcut for the following:
$set = new SimpleJWT\Keys\KeySet();
$key = new SimpleJWT\Keys\SymmetricKey('secret123', 'bin');
$set->add($key);
// Note $headers['alg'] and $headers['enc'] are ' => 'A128CBC-HS256'];
$plaintext = 'This is the plaintext I want to encrypt.';
$jwt = new SimpleJWT\JWE($headers, $plaintext);