PHP code example of socialconnect / jwx
1. Go to this page and download the library: Download socialconnect/jwx 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/ */
socialconnect / jwx example snippets
$jwt = new \SocialConnect\JWX\JWT([
'uid' => 5,
]);
$encodeOptions = new \SocialConnect\JWX\EncodeOptions();
$encodeOptions->setExpirationTime(600);
$token = $jwt->encode('TEST', 'HS256', $encodeOptions);
var_dump($token);
$decodeOptions = new \SocialConnect\JWX\DecodeOptions(['HS256']);
$token = \SocialConnect\JWX\JWT::decode('TEST', $token, $decodeOptions);
var_dump($token);