PHP code example of gisostallenberg / fixed-token

1. Go to this page and download the library: Download gisostallenberg/fixed-token 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/ */

    

gisostallenberg / fixed-token example snippets




use GisoStallenberg\FixedToken\FixedToken;

$secret = 'oxQu/H2FZLOK2elkfle8bg./eg';
$data = array(
    'username' => 'giso',
);

$token = FixedToken::create($secret)
    ->addData($data)
    ->generate();

FixedToken::create($secret)
    ->addData($data)
    ->verify($token); // should return true