aporat/laravel-rate-limiter

Request and actions rate limiter middleware for Laravel and Lumen

v1.0.0 2020-08-24 03:58 UTC

This package is auto-updated.

Last update: 2024-11-06 01:17:56 UTC


README

Latest Stable Version Composer Downloads Build Status Code Coverage Scrutinizer Code Quality

Request and actions rate limiter middleware for Laravel and Lumen

Installation

The rate-limiter service provider can be installed via Composer.

composer require aporat/laravel-rate-limiter

To use the RateLimiter service provider, you must register the provider when bootstrapping your application.

Laravel

Laravel 5.5 and above

The package will automatically register provider and facade.

Laravel 5.4 and below

Add Aporat\RateLimiter\RateLimiterServiceProvider to the providers section of your config/app.php:

    'providers' => [
        // ...
        Aporat\RateLimiter\RateLimiterServiceProvider::class,
    ];

Add RateLimiter facade to the aliases section of your config/app.php:

    'aliases' => [
        // ...
        'RateLimiter' => Aporat\RateLimiter\Facade\RateLimiter::class,
    ];

Or use the facade class directly:

  use Aporat\RateLimiter\Facade\RateLimiter;

Now run php artisan vendor:publish to publish config/rate-limiter.php file in your config directory.

Lumen

Register the Aporat\RateLimiter\RateLimiterServiceProvider in your bootstrap/app.php:

    $app->register(Aporat\RateLimiter\RateLimiterServiceProvider::class);

Copy the rate-limiter.php config file in to your project:

    mkdir config
    cp vendor/aporat/laravel-rate-limiter/Config/rate-limiter.php config/rate-limiter.php

Configuration

Usage

Credits

License

The MIT License (MIT). Please see License File for more information.