hoangnamitc/csrf-token

This package is abandoned and no longer maintained. No replacement package was suggested.

hoangnamitc.com

v2.0.1 2018-04-17 14:54 UTC

This package is auto-updated.

Last update: 2021-12-15 22:51:05 UTC


README

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