1. Go to this page and download the library: Download geggleto/securejwt 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/ */
geggleto / securejwt example snippets
composer
$config = new \Lcobucci\JWT\Builder(); // This object helps to simplify the creation of the dependencies
// instead of using "?:" on constructors.
$token = $config->setIssuer('http://example.com') // Configures the issuer (iss claim)
->setAudience('http://example.org') // Configures the audience (aud claim)
->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim)
->setExpiration(time() + 3600) // Configures the expiration time of the token (exp claim)
->set('uid', 1) // Configures a new claim, called "uid"
->getToken(); // Retrieves the generated token
$secureJwt = new \SecureJwt\SecureJwt('./sec/encryption.key');
$securedToken = $secureJwt->encryptToken((string)$token); //<--- This is the encrypted token
$tokenString = $secureJwt->decryptToken($securedToken);
$newToken = (new \Lcobucci\JWT\Parser())->parse($tokenString);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.