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

Latest commit

 

History

History
77 lines (56 loc) · 1.16 KB

README.md

File metadata and controls

77 lines (56 loc) · 1.16 KB

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