PHPackages                             dasprid/csrf-guard - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dasprid/csrf-guard

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

dasprid/csrf-guard
==================

PSR-7 CSRF guard

3.1.0(8y ago)1743BSD-2-ClausePHPPHP ^7.1

Since Apr 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DASPRiD/CSRF-Guard)[ Packagist](https://packagist.org/packages/dasprid/csrf-guard)[ RSS](/packages/dasprid-csrf-guard/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (8)Versions (7)Used By (0)

CSRF Guard
==========

[](#csrf-guard)

[![Build Status](https://camo.githubusercontent.com/4698ace634a4704e88fd7ce64d2e99d9349c0220072631145c1af178db9eeaec/68747470733a2f2f7472617669732d63692e6f72672f444153505269442f435352462d47756172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DASPRiD/CSRF-Guard)[![Coverage Status](https://camo.githubusercontent.com/62fd296f70818e2b2218498db0887d3b326d2044c06e47a0bacc00102db25cda/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f444153505269442f435352462d47756172642f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/DASPRiD/CSRF-Guard?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/bd39e4b1a2213c2b1a9a8a1d3f076c79fb3999cefe2364e3d30f54f7e51d8fe1/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f637372662d67756172642f762f737461626c65)](https://packagist.org/packages/dasprid/csrf-guard)[![Total Downloads](https://camo.githubusercontent.com/b37d6664513618241189a66999be8ba9579358ab5310309a6b62ddf9dc10807a/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f637372662d67756172642f646f776e6c6f616473)](https://packagist.org/packages/dasprid/csrf-guard)[![License](https://camo.githubusercontent.com/a1823df11f6bc91d17ed9a8df74c7450a7287432cab0229ad97d682d3af585cf/68747470733a2f2f706f7365722e707567782e6f72672f646173707269642f637372662d67756172642f6c6963656e7365)](https://packagist.org/packages/dasprid/csrf-guard)

CSRF Guard is a library which helps to protect against CSRF attacks.

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

[](#installation)

Install via composer:

```
$ composer require dasprid/csrf-guard
```

Usage
-----

[](#usage)

CSRF Guard is usable with any library implementing the interop middleware or PSR-15 standard. It comes with some pre-defined factories which utilize the PSR-11 container standard and a config provider which can be used with container implementations like Zend\\ServiceManager. If you are using that or a similar container implementation together with Zend\\Expressive, you can register your factories by simply having an autoloaded config file looking like this:

```
