Lumen port of Laravel ThrottleRequests middleware

1.1.0 2022-02-20 17:36 UTC

This package is auto-updated.

Last update: 2022-07-04 13:13:50 UTC


Lumen Rate limiting

Total Downloads Latest Stable Version License


This package contains Lumen port of Laravel's ThrottleRequests middleware


  1. Require the package on your Lumen application
composer require rogervila/lumen-rate-limiting
  1. Make sure that AppServiceProvider and AuthServiceProvider are uncommented on bootstrap/app.php
  1. Configure a rate limiter on the AppServiceProvider boot method
 * Configure global rate limiter
 * @return void
public function boot()
    app(\Illuminate\Cache\RateLimiter::class)->for('global', function () {
        return \Illuminate\Cache\RateLimiting\Limit::perMinute(60)->by(request()->ip());
  1. Register the middleware on bootstrap/app.php
    'throttle' => \LumenRateLimiting\ThrottleRequests::class,
  1. Add the middleware to the global router group on bootstrap/app.php
    'namespace' => 'App\Http\Controllers',
    'middleware' => 'throttle:global',
], function ($router) {
    require __DIR__ . '/../routes/web.php';

The middleware can be placed on specific routes instead of globally, as defined on the official documentation.


This project is open-sourced software licensed under the MIT license.