Hello.
I'd like to use this library with psr-7 but because this library relies in global variables $_POST, $_SESSION and $_SERVER, I've changed some static methods of the class to be instantiable. This allows to reuse the library with custom post/session/server parameters. For example:
use ParagonIE\AntiCSRF\AntiCSRF;
//Use the global variables $_POST, $_SESSION and $_SERVER
$csrf = new AntiCSRF();
//Use custom variables
$csrf = new AntiCSRF($request->getParsedBody(), $session, $request->getServerParams());
//check the request
$valid = $csrf->validateRequest();
Hello. I'd like to use this library with psr-7 but because this library relies in global variables
$_POST
,$_SESSION
and$_SERVER
, I've changed some static methods of the class to be instantiable. This allows to reuse the library with custom post/session/server parameters. For example: