PHP code example of dframe / token

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

    

dframe / token example snippets



use Dframe\Session\Session;
use Dframe\Token\Token;

$driver = new Session('sessionName');

/** 
 * $driver Can be any class implements interface \Psr\SimpleCache\CacheInterface 
 */
$token  = new Token($driver); 
$key = $token->generate('evidenceToken')->get('evidenceToken');  // Generate hash
$isValid = $token->isValid('evidenceToken', $key);            // Return true/false
$has = $token->has('evidenceToken');            // Return true/false