1. Go to this page and download the library: Download ekok/php-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/ */
ekok / php-jwt example snippets
$options = array(
'key' => 'mySecr3TKey~',
// options defaults value
// 'id' => null, // or jti
// 'leeway' => 0,
// 'keyId' => null,
// 'publicKeys' => array(),
// 'header' => array(),
// 'algorithm' => null, // or alg
// 'issuer' => null, // or iss
// 'expires' => null, // or exp
// 'subject' => null, // or sub
// 'audience' => null, // or aud
// 'notBefore' => null, // or nbf
// 'issuedAt' => null, // or iat
);
$jwt = new Ekok\JWT\Manager($options);
$payload = array(
'foo' => 'bar',
);
$token = $jwt->encode($payload);
$decoded = $jwt->decode($token);
// $decoded === $payload
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.