Download the PHP package bm2ilabs/rate-limiter without Composer
On this page you can find all versions of the php package bm2ilabs/rate-limiter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bm2ilabs/rate-limiter
More information about bm2ilabs/rate-limiter
Files in bm2ilabs/rate-limiter
Package rate-limiter
Short Description Multi-period rate limiting for Laravel applications with minute, hour, and day limits
License MIT
Informations about the package rate-limiter
Amineware Rate Limiter
A comprehensive Laravel package for implementing multi-period rate limiting in your application. This package allows you to easily set and enforce rate limits for different time intervals (minute, hour, day) and automatically includes these limits in your API response headers.
Features
- Rate limiting for multiple time periods (minute, hour, day)
- Custom response headers for each period
- Configurable limits through environment variables or config file
- Easy to use middleware
- Support for different identifiers (IP, authenticated user, custom parameter)
- Compatible with Laravel 8.x, 9.x, 10.x, and 11.x
Installation
You can install the package via composer:
Configuration
Publish the configuration file:
This will create a rate-limiter.php file in your config directory. You can customize the rate limits and other settings in this file.
Basic Usage
Add the middleware to your routes:
Or apply it to specific routes:
Response Headers
When using this middleware, your API responses will include the following headers:
If a rate limit is exceeded, the response will include:
Advanced Usage
Using the Facade
You can use the facade to manually check or manipulate rate limits:
Custom Identifiers
By default, the package uses the authenticated user ID or IP address as the identifier. You can customize this in the config file:
Environment Variables
You can set rate limits through environment variables:
License
The MIT License (MIT). Please see License File for more information.
All versions of rate-limiter with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/routing Version ^8.0|^9.0|^10.0|^11.0|^12.0