An open API service indexing awesome lists of open source software.

https://github.com/phrenotype/figleaf

Keep bots and unwanted humans away from your website
https://github.com/phrenotype/figleaf

csrf csrf-form csrf-protection figleaf php php-csrf

Last synced: 20 days ago
JSON representation

Keep bots and unwanted humans away from your website

Awesome Lists containing this project

README

          

# FigLeaF
![license](https://img.shields.io/github/license/phrenotype/figleaf)
![contributors](https://img.shields.io/github/contributors/phrenotype/figleaf)
![code size](https://img.shields.io/github/languages/code-size/phrenotype/figleaf)
![downloads](https://img.shields.io/packagist/dm/chase/figleaf)

This library keeps bots and unwanted humans from making requests to your website.

It offers full csrf token generation and validation, without external dependencies.

With this, a brute force attack is only possible with browser automation, hence increased cost.

## Install
`composer require figleaf/figleaf`

## Usage

To generate a csrf token for some random use ( you decide )

```php

```
Again, to get an input based on the old or current value, use `FigLeaf::input()`.

You can then go on to add the input to your form or web request as the case may be.

## Validation

After a form is submitted or a request is sent by a user, you validate it by passing an associative array based on the request medium

```php
passed()){
// Do something
}

if($validator->failed()){
// Do something
}

```

## Recommendation
It is highly recommeded you always generate new tokens per request, otherwise, this whole 'keeping bots and unwanted humans' away thing will just be an empty promise.

## Contact
**Email** : paul.contrib@gmail.com