PHP code example of soatok / wp-paseto
1. Go to this page and download the library: Download soatok/wp-paseto 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/ */
soatok / wp-paseto example snippets
// Define your keys
$encoder = new WP_Paseto((
'key-id-1' => 'hex-encoded 256-bit (32 byte) random key goes here',
'key-id-2' => 'hex-encoded 256-bit (32 byte) random key goes here',
// ...
'key-id-N' =>L 'hex-encoded 256-bit (32 byte) random key goes here'
));
// Encode a secret
$token = $encoder->encode(array('secret' => 'value goes here'));
var_dump($token);
/* v4.local.fHvh8jwJauiNMdC0yRZ9xvbCE5cdrNwP4... */
// Decode
$claims = $encoder->decode($token);