hedii / laravel-throttle-route
A Laravel package to throttle requests based on route name
Installs: 61 874
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: ^7.2.5
- laravel/framework: ^7.0
Requires (Dev)
- orchestra/testbench: ^5.0
This package is auto-updated.
Last update: 2024-11-29 05:44:55 UTC
README
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.