Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
CSRF Token Generation Library
PHP
branch: master

README.md

csrf

A CSRF Token Generation Library

Supports code generation via:

  • OpenSSL
  • Bcrypt
  • SH256

Example usage, generating a random token using the OpenSSL extension:

<?php
require_once 'vendor/autoload.php';

$token = \Psecio\Csrf\Token::generate('random');
echo 'token: '.var_export($token, true)."\n";
?>

Example using the options to set the "cost" for the bcrypt hasing:

<?php
$options = array(
    'method' => 'bcrypt'
    'cost' => 32
);
require_once 'vendor/autoload.php';

$token = \Psecio\Csrf\Token::generate('random', $options);
echo 'token: '.var_export($token, true)."\n";
?>

Valid types and options:

random

Optons:

  • method: [bcrypt, openssl, sha256]

file

Options:

  • path
Something went wrong with that request. Please try again.