PHPackages                             steveclifton/phpcsrftokens - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. steveclifton/phpcsrftokens

ActiveLibrary[Security](/categories/security)

steveclifton/phpcsrftokens
==========================

Simple PHP CSRF token generator and verifier

v1.4(7y ago)113.5k—0%5[1 issues](https://github.com/steveclifton/PhpCsrfTokens/issues)[1 PRs](https://github.com/steveclifton/PhpCsrfTokens/pulls)MITPHPPHP &gt;=5.3.0

Since Mar 2Pushed 2y ago2 watchersCompare

[ Source](https://github.com/steveclifton/PhpCsrfTokens)[ Packagist](https://packagist.org/packages/steveclifton/phpcsrftokens)[ RSS](/packages/steveclifton-phpcsrftokens/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (5)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/b6c89fd0f6d4468df95faf9de5ad4cc3fb7292756863be9be453a2300bb82aaa/68747470733a2f2f706f7365722e707567782e6f72672f7374657665636c6966746f6e2f70687063737266746f6b656e732f762f737461626c65)](https://packagist.org/packages/steveclifton/phpcsrftokens)[![Total Downloads](https://camo.githubusercontent.com/21826b8cd474a0090773c3e79190453742bd7ae07bab5213ca13f0f5a21ba68d/68747470733a2f2f706f7365722e707567782e6f72672f7374657665636c6966746f6e2f70687063737266746f6b656e732f646f776e6c6f616473)](https://packagist.org/packages/steveclifton/phpcsrftokens)[![License](https://camo.githubusercontent.com/230d78a2cc700cb7eef4ee64ee5aa652e597063d3d8da47366c0cf783038f069/68747470733a2f2f706f7365722e707567782e6f72672f7374657665636c6966746f6e2f70687063737266746f6b656e732f6c6963656e7365)](https://packagist.org/packages/steveclifton/phpcsrftokens)[![Monthly Downloads](https://camo.githubusercontent.com/04c6d69c7353df017de393397b9899b68545eb4b576dd352e2f5f258d24c189a/68747470733a2f2f706f7365722e707567782e6f72672f7374657665636c6966746f6e2f70687063737266746f6b656e732f642f6d6f6e74686c79)](https://packagist.org/packages/steveclifton/phpcsrftokens)[![Daily Downloads](https://camo.githubusercontent.com/da9b8256ccdb10d8a145a2bb9e343addffae8d295ba0e2232f7e75ecf740f6f5/68747470733a2f2f706f7365722e707567782e6f72672f7374657665636c6966746f6e2f70687063737266746f6b656e732f642f6461696c79)](https://packagist.org/packages/steveclifton/phpcsrftokens)

PHP Csrf Tokens
===============

[](#php-csrf-tokens)

PHP Csrf Tokens is a simple session &amp; cookie based csrf token generator and verifier.

Installation
------------

[](#installation)

Via Composer

```
$ composer require steveclifton/phpcsrftokens
```

Usage
-----

[](#usage)

For ease of use, all PHP Csrf Tokens methods have been made static to make generation and verification as simple as possible.

Following the OWASP guidelines, the `verifyToken()` method *does not* reset the tokens after each request, enabling double submission of the form.

Requires superglobal `$_SESSION` to be set.

```
