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

ActiveLibrary[Security](/categories/security)

psecio/csrf
===========

CSRF Token Generation Library

1.0(10y ago)123015MITPHPPHP &gt;=5.3.1

Since Oct 24Pushed 10y ago3 watchersCompare

[ Source](https://github.com/psecio/csrf)[ Packagist](https://packagist.org/packages/psecio/csrf)[ Docs](https://github.com/psecio/csrf.git)[ RSS](/packages/psecio-csrf/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

CSRF Handling
-------------

[](#csrf-handling)

Cross-site request forgery (CSRF) tokens provide protection for your request submissions to help ensure they came from your application. The most common implementation in PHP uses the current session to store the token value and makes a comparison once the form is submitted. This library makes it simpler by handling this common task for you buy default. It:

- Provides effective random token generation via either OpenSSL or the PHP 7 csprng
- Handles the session storage and evaluation once the data is submitted.

Here's an example of it in use:

```
