Skip to content

The Token component generate and store a unique token which can be used to help prevent

License

Notifications You must be signed in to change notification settings

flextype-components/token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Component

version MIT License

The Token component generate and store a unique token which can be used to help prevent CSRF attacks.

Installation

composer require flextype-components/token

Usage

Generate token

use Flextype\Component\Token\Token;

$token = Token::generate();

Generate token in the template

<?php use Flextype\Component\Token\Token; ?>
<input type="hidden" name="csrf" value="<?php echo Token::generate(); ?>">

Check that the given token matches the currently stored security token.

use Flextype\Component\Token\Token;

if (Token::check($token)) {
    // Pass
}

License

See LICENSE

About

The Token component generate and store a unique token which can be used to help prevent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages