rapidsquirrel/laravel-rate-limiter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rapidsquirrel/laravel-rate-limiter

Composer 安装命令:

composer require rapidsquirrel/laravel-rate-limiter

包简介

A robust and customizable rate-limiting middleware for laravel

README 文档

README

This project implements a rate limiter for a Laravel application, providing protection against excessive requests and potential abuse.

Features

  • Simple integration with Laravel framework.
  • Configurable request limits.
  • Middleware for applying rate limits on specific routes.

Installation

  1. Clone the repository:
git clone https://github.com/amrq88/laravel-rate-limiter.git
cd laravel-rate-limiter
  1. Install dependencies:
composer install
  1. Copy the example environment file and update your environment variables:
cp .env.example .env
php artisan key:generate
  1. Run the migrations:
php artisan migrate

Configuration

You can configure the rate limiter settings in the config/rate_limiter.php file.

return [
    'limits' => [
        'default' => [
            'max_attempts' => 60,
            'decay_minutes' => 1,
        ],
        // Add other rate limit configurations here
    ],
];

Usage

Apply the rate limiter middleware to your routes in routes/web.php or routes/api.php:

use App\Http\Middleware\RateLimiter;

Route::middleware([RateLimiter::class])->group(function () {
    Route::get('/your-route', [YourController::class, 'yourMethod']);
});

Contributing

If you would like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any inquiries, please contact Amr Qawasmeh.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-06