PHP code example of antikirra / token

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

    

antikirra / token example snippets




declare(strict_types=1);

use Antikirra\AbstractToken;

ed static function type(): int
    {
        // token type in the range from 1 to 255
        return 1;
    }

    protected static function salt(): string
    {
        // !!! DO NOT MODIFY AFTER SETUP !!!
        return '4Q8myx0n8mrdLs6ZdEvpp9ekV78nhn5P4ruf9Z96tu4ZEVlmWeGawymg3W0mkgPj';
    }

    protected static function algorithm(): string
    {
        // hash()
        return 'xxh128';
    }
}

$token = MySecretToken::create(123456, new DateTimeImmutable('+1 day'));

var_dump((string)$token); // AQBA4gEAAAAAAPDcoGguuFT3rMY17QZy-gmNOs1dIQWcR

print_r($token);
//MySecretToken Object
//(
//    [type:protected] => 1
//    [identity:protected] => 123456
//    [expiredAt:protected] => DateTimeImmutable Object
//        (
//            [date] => 2025-08-16 19:33:33.355526
//            [timezone_type] => 3
//            [timezone] => UTC
//        )
//
//    [nonce:protected] => 2851849735
//    [signature:protected] => <bynary>
//)