phpolar/csrf-protection

Provides request checking and response filtering to mitigate CSRF attacks

3.1.0 2023-09-02 22:12 UTC

This package is auto-updated.

Last update: 2024-10-28 01:16:58 UTC


README

Csrf Protection

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

Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

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