phpolar/csrf-protection

提供请求检查和响应过滤,以减轻CSRF攻击

3.1.0 2023-09-02 22:12 UTC

This package is auto-updated.

Last update: 2024-08-28 00:58:37 UTC


README

CSRF保护

基于PSR-7和PSR-15的HTTP请求CSRF保护

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

目录

  1. 安装
  2. 用法
  3. 资源
  4. API文档

安装

composer require phpolar/csrf-protection

用法

$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);

资源

  1. PSR-7
  2. PSR-15
  3. 中间件设置示例

API文档

阈值

返回顶部