Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

hoangnamitc/csrf-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

csrf-token

Class Anti Security CSRF TOKEN

This project is available on Packagist, and installation via Composer is the recommended way to install csrf-token. Just add this line to your composer.json file:

"hoangnamitc/csrf-token": "~2.0"

or run

composer require hoangnamitc/csrf-token

Installing

require 'token.class.php';

or via composer

require 'vendor/autoload.php';

Usage

  • Initial
$token = new \hoangnamitc\Token('token_name');
  • Choose times create token after refresh
$token->set();        // Token create one times
$token->set('*', 10); // Token create with time lives is 10 second
$token->set('*');     // Token create many times, created continuity.
  • Get name Token
$token->getName();
  • Get value of Token:
$token->getToken();
  • Validate Token
if ( $token->validate($token_value) ) {
    // Valid
} else {
    // invalid
}
  • Detele token curently
$token->delete();
  • Debug code
$token->debug();

$token->deleteAll()

Authors

hoangnamitc