2017 © Pedro Peláez
 

library csrf

A quick and easy stateless CSRF protection for forms.

image

zoxta/csrf

A quick and easy stateless CSRF protection for forms.

  • Friday, November 13, 2015
  • by zOxta
  • Repository
  • 1 Watchers
  • 1 Stars
  • 50 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Quick CSRF

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Quick CSRF offers stateless CSRF protection for forms that requires almost zero-configuration. It uses the JSON Web Token standard so it does not depend on session/cookies., (*2)

Quick CSRF depends on the beautiful lcobucci/jwt JWT implementation., (*3)

Installation

Edit your project's composer.json to require zoxta/csrf., (*4)

"require": {
    "zoxta/csrf": "dev-master"
}

Then run composer update, (*5)

Usage

Just instantiate the class and you will be ready to go. You will also find an sample usage in the example directory., (*6)

isInvalid()) {

        # return an error if CSRF token is invalid/expired
        echo '

Invalid token, stop.

'; } else { echo '

Valid token, process form.

'; } exit; } ```` You can also just use the `isValid()` method immediately without any other requirements. ````php if ($CsrfToken->isValid()) { # process the form request echo '

Valid token, process form.

'; exit; } ```` To echo the CSRFT token in your forms, you have two simple ways. You can either echo the token itself: ````html

Or you can echo the whole input field for simplicity using $CsrfToken->field() as the following:, (*7)



= $CsrfToken->field() ?>

TODO

  • Ability to edit default JWT options.
  • Ability to support sending tokens via GET requests or request header.

The Versions

13/11 2015

dev-master

9999999-dev

A quick and easy stateless CSRF protection for forms.

  Sources   Download

MIT

The Requires

 

by Islam Essam

jwt csrf

27/09 2015

0.1.2

0.1.2.0

A quick and easy stateless CSRF protection for forms.

  Sources   Download

MIT

The Requires

 

by Islam Essam

jwt csrf