1. Go to this page and download the library: Download gbrousse/php-token-manager 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/ */
gbrousse / php-token-manager example snippets
use TokenManager\TokenManager;
// Setup
$options = array(
'dir' => 'directory/where/stock/tokens',
'prefix' => 'prefix_of_tokens_files',
'salt' => 'salt',
'hash' => 'md5', // hash use to generate token
'maxTimeout' => 7200, //max lifetime for a token
'maxTimeout' => 600, //min lifetime for a token
);
$TokenMgr = new TokenManager($options);
// Get token
$token = $TokenMgr->get();
use TokenManager\TokenManager;
// Setup
$options = array(
'dir' => 'directory/where/stock/tokens',
'prefix' => 'prefix_of_tokens_files',
'salt' => 'salt',
'hash' => 'md5', // hash use to generate token
'maxTimeout' => 7200, //max lifetime for a token
'maxTimeout' => 600, //min lifetime for a token
);
$TokenMgr = new TokenManager($options);
// Verify token validity
if($TokenMgr->isValid($token)){
// action to do if token is OK
}
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.