PHPackages                             internetpixels/csrf-protection - 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. internetpixels/csrf-protection

ActiveLibrary[Security](/categories/security)

internetpixels/csrf-protection
==============================

Protect your web app from malicious requests by using CSRF protection tokens in links and forms

0.2(3y ago)32.2kPHPPHP &gt;=7.4

Since Jun 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/internetpixels/csrf-protection)[ Packagist](https://packagist.org/packages/internetpixels/csrf-protection)[ RSS](/packages/internetpixels-csrf-protection/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

CSRF Protection
===============

[](#csrf-protection)

Protect your web app from malicious requests by using CSRF protection tokens in links and forms. This CSRF protection library does not use sessions, files, memory storage or databases.

[![License](https://camo.githubusercontent.com/cf76db379873b010c163f9cf1b5de4f5730b5a67/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f6d69742f6d69742e7376673f763d313032)](https://github.com/internetpixels/csrf-protection)[![Build Status](https://camo.githubusercontent.com/0f910f94b8534f85432df946d36d89598488050b0f281af3ddb84d5154f82a2f/68747470733a2f2f7472617669732d63692e6f72672f696e7465726e6574706978656c732f637372662d70726f74656374696f6e2e737667)](https://travis-ci.org/internetpixels/csrf-protection)[![Maintainability](https://camo.githubusercontent.com/af95d3dc77484f42090aaebde151552fa7ede9a40c7309935a2b24108a653aac/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64306438313761323163613732343334333362332f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/internetpixels/csrf-protection)

Basic examples
--------------

[](#basic-examples)

In the examples below you'll find the 3 most important methods:

- `TokenManager::create();`
- `TokenManager::createHtmlField();`
- `TokenManager::validate();`

*The full namespace is `InternetPixels\CSRFProtection\TokenManager`.*

### Setup the TokenManager

[](#setup-the-tokenmanager)

You have to set some settings for a secure TokenManager. Please overwrite the salt by your own one.

```
