PHPackages                             julfiker/csrf-php - 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. julfiker/csrf-php

ActiveService

julfiker/csrf-php
=================

PHP library for generating csrf token and checking on post action

v1.1(8y ago)423MITPHPPHP &gt;=5.3.3

Since Mar 23Pushed 8y ago1 watchersCompare

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

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

csrf-php
========

[](#csrf-php)

Generating csrf token and checking in POST|PULL|DELETE method action. Its independent service for php application. You can integrated it php any kind application.
[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0932ad4e8456438a818b5bc83980f54ce5bf48f7a2848c5348ade412872ff7a2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c66696b65722f637372662d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/julfiker/csrf-php/?branch=master)[![Build Status](https://camo.githubusercontent.com/322f95d5aa8177e0624a93eb5be28771e987b16646a9e46691b799f88504311a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c66696b65722f637372662d7068702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/julfiker/csrf-php/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/c847f269d1942a40bf4d7be39893c4060d926f629fbfbee622472d54fc0402db/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c66696b65722f637372662d7068702f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

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

[](#installation)

```
composer require julfiker/csrf-php
```

Just run composer require command with package name. This assumes you have composer installed and available in your path as composer. Instruction to have composer .

How to use in plain php application
-----------------------------------

[](#how-to-use-in-plain-php-application)

```
require_once __DIR__."/vendor/autoload.php";
use Julfiker\Service\CsrfManager as Csrf;
$csrf = new Csrf();
$csrf->setExpiredAt(10); //10 minutes; But default it has 30 minutes
$token = $csrf->getCSRFToken();
$tokenFieldName = $csrf->getTokenFieldName();
```

```

    Subscribes email
