hedii/laravel-throttle-route

A Laravel package to throttle requests based on route name
61,880
Install
composer require hedii/laravel-throttle-route
Latest Version:2.0.0
PHP:^7.2.5
License:MIT
Last Updated:Nov 4, 2020
Links: GitHub  ·  Packagist
Maintainer: hedii

Build Status

Laravel Throttle Route

A Laravel package to throttle requests based on route name.

The default Laravel request throttler acts as a global throttler based on user ID or IP. This package allows to have a request limit set by route, by using the route name to resolve the request signature.

Installation

Install with composer

composer require hedii/laravel-throttle-route

Usage

Add the middleware in your route, and use it as the default Laravel ThrottleRequests middleware.

Don't forget to set a route name.

Route::get('/first', 'FirstController@show')
    ->middleware(\Hedii\LaravelThrottleRoute\ThrottleRequests::class . ':20,1')
    ->name('first');
    
Route::get('/second', 'SecondController@show')
    ->middleware(\Hedii\LaravelThrottleRoute\ThrottleRequests::class . ':60,1')
    ->name('second');

Testing

composer test

License

laravel-throttle-route is released under the MIT Licence. See the bundled LICENSE file for details.

Related Packages

ctsoftwarellc/laravel-mail-throttle

Distributed rate limiting for Laravel mail across multiple queue workers

1,439 2
aporat/laravel-rate-limiter

A flexible rate limiting middleware for Laravel and Lumen applications

2,433 4
amiiiiink/laravel-rate-limiter

A flexible rate limiting middleware for Laravel and Lumen applications

4 1
hedii/laravel-date-range

A date range trait with local scope methods for Laravel Eloquent models

40,567 21
hedii/artisan-log-cleaner

An artisan command to clear laravel log files

70,306 41

Version History

Version Released PHP Laravel License
2.0.0 ^7.2.5 ^7.0 MIT
1.1.0 ^5.7|^6.0 MIT
1.0.0 ^5.7 MIT