1. Go to this page and download the library: Download ingenerator/tokenista 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/ */
ingenerator / tokenista example snippets
$secret = 'some-constant-secret-value';
$tokenista = new \Ingenerator\Tokenista($secret, array('lifetime' => 3600));
// Generate with default lifetime from constructor options
$token = $tokenista->generate();
// Overall check if token is valid
if ($tokenista->isValid($token)) {
// Do whatever
}
// Or for more control use:
$tokenista->isExpired($token);
$tokenista->isTampered($token);
$token = $tokenista->generate(3600, ['user_id' => 9123]);
// Then, later:
if ($tokenista->isValid($_GET['token'], ['user_id' => $_GET['user_id']]) {
// You can now trust user_id, even if it came through the URL, because it matches the value you originally signed
// for this token.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.