PHP code example of kelvinmo / fernet-php
1. Go to this page and download the library: Download kelvinmo/fernet-php 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/ */
kelvinmo / fernet-php example snippets
Fernet\Fernet;
$key = '[Base64url encoded fernet key]';
$fernet = new Fernet($key);
$token = $fernet->encode('string message');
$message = $fernet->decode('fernet token');
if ($message === null) {
echo 'Token is not valid';
}