phpolar/csrf-protection

Provides request checking and response filtering to mitigate CSRF attacks

3.1.1 2024-12-01 21:19 UTC

This package is auto-updated.

Last update: 2024-12-09 04:05:59 UTC


README

Csrf Protection

PSR-7 and PSR-15 based CSRF protection for HTTP requests

Coverage Status Latest Stable Version Total Downloads PHP Version Require PHPMD PHP Build Latest and Nightly

Table of Contents

  1. Installation
  2. Usage
  3. Resources
  4. API Documentation

Installation

composer require phpolar/csrf-protection

Usage

$csrfChecking = $this->container->get(CsrfRequestCheckMiddleware::class);
$csrfFiltering = $this->container->get(CsrfResponseFilterMiddleware::class);

$app->use($csrfChecking);
$app->use($csrfFiltering);

// ...

$response = $csrfCheckMiddleware->process($request, $nextHandler);

// ...

$preparedResponse = $middleWare->process($request, $routingHandler);

Resources

  1. PSR-7
  2. PSR-15
  3. Example middleware setup

API Documentation

Thresholds

Back to top