floriansemm/expose-bundle

v0.1.1 2017-08-11 13:41 UTC

This package is auto-updated.

Last update: 2024-09-07 23:45:24 UTC


README

expose 项目集成到 symfony。它允许您注册处理程序以响应当前请求的报告。(用于阻止用户/IP,发送通知等。)

此捆绑包增加了一个“挂起请求”功能。如果当前请求的影响大于配置的阈值(默认为7),则将抛出 IntrusionException。在抛出异常之前,将执行所有注册的处理程序。

安装

composer require floriansemm/expose-bundle

注册捆绑包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FS\ExposeBundle\FSExposeBundle(),
    );
}

将配置添加到您的 config.yml

fs_expose: ~

配置

如果您想允许所有请求,无论发生何种影响,请将 impact 选项设置为0

fs_expose:
    request_suspension:
        impact: 0

添加入侵处理程序

  1. 创建一个实现 IntrusionHandlerInterface 的服务
  2. 使用 expose.intrusion_handler 标记服务