承接 nw/request-limit-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nw/request-limit-bundle

Composer 安装命令:

composer require nw/request-limit-bundle

包简介

This bundle provides a light way to restrict user access to some action for a specific time frame

README 文档

README

SensioLabsInsight Build Status Scrutinizer Code Quality Maintainability

RequestLimitBundle

This bundle is a simple solution to restrict user access to some controller for a specified timeline.

This functionality could be used for different cases when you need to:

  • prevent flood - pushing users of irrelevant data;
  • prevent a user from accessing the certain endpoint very often, etc.

Installation

  1. Install package via:
    composer require nw/request-limit-bundle
  1. Register bundle :

In app/AppKernel.php prior to Symfony version 4.0:

public function registerBundles()
{
    $bundles = [
        // ... ,
        new NW\RequestLimitBundle\NWRequestLimitBundle()
    ];

    // ...
    return $bundles;
}

In config/bundles.php when Symfony version is 4.0 and higher

return [
    //... other bundles
    NW\RequestLimitBundle\NWRequestLimitBundle::class => ['all' => true]
];
  1. Configure the bundle according to the provider you would like to use. Out of the box, we provide the Memcached and MySQL providers. To see configuration options, see the docs below.

If you want to use other storage, you can implement your provider.

  1. Specify restriction_time in seconds:
nw_request_limit:
    #... options for provider configuration
    restriction_time: 5  # 5 seconds

Usage

In your action, add the following line to restrict access by some specific application user artifact (e.g., user id, user IP, etc.):

$artifact = 'e.g. get user id or IP here';
$this->get('nw.request_limit.restrictor')->blockBy($artifact);

These will restrict user access for a time frame specified in your configuration (5 seconds accordingly to).

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固