Download the PHP package grazulex/laravel-api-throttle-smart without Composer
On this page you can find all versions of the php package grazulex/laravel-api-throttle-smart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grazulex/laravel-api-throttle-smart
More information about grazulex/laravel-api-throttle-smart
Files in grazulex/laravel-api-throttle-smart
Package laravel-api-throttle-smart
Short Description Intelligent, plan-aware rate limiting for Laravel APIs - Built for SaaS, multi-tenant, and enterprise applications
License MIT
Homepage https://github.com/grazulex/laravel-api-throttle-smart
Informations about the package laravel-api-throttle-smart
Laravel API Throttle Smart
Intelligent, plan-aware rate limiting for Laravel APIs - Multi-algorithm, multi-tenant, quota management
Features
- Plan-Based Limits - Define different rate limits per subscription plan (Free, Pro, Enterprise)
- Multiple Algorithms - Fixed Window, Sliding Window, or Token Bucket
- Multi-Window Limits - Per-second, minute, hour, day, and month limits
- Quota Management - Daily/monthly API quota with alerts and top-ups
- Multi-Tenant Scoping - Scope by user, team, tenant, or IP
- Multiple Storage Drivers - Cache, Redis, or Database
- RFC 7231 Compliant - Standard rate limit headers
- Burst Handling - Token bucket algorithm for controlled bursts
- Artisan Commands - Status, analytics, cleanup, and management tools
- Testing Helpers - Fluent testing API with
ThrottleSmartFake
Requirements
- PHP 8.3+
- Laravel 11.x or 12.x
Installation
Publish the configuration:
For database driver, publish migrations:
Quick Start
Apply the middleware to routes:
The middleware automatically:
- Resolves the user's plan from the
planattribute - Applies plan-specific rate limits
- Adds standard rate limit headers
- Returns 429 when limits exceeded
Response Headers
When rate limited:
Plan Configuration
PHP Attributes
Programmatic Usage
Rate Limiting Algorithms
Fixed Window (Default)
Simple counter-based limiting with discrete time windows.
Sliding Window
Weighted average across windows for smoother rate limiting.
Token Bucket
Allows controlled bursts while maintaining average rate.
Artisan Commands
Events
Testing
Integration testing:
Quality Tools
Error Responses
| Code | Status | Description |
|---|---|---|
RATE_LIMIT_EXCEEDED |
429 | Rate limit exceeded for time window |
QUOTA_EXCEEDED |
429 | Monthly/daily quota exceeded |
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Jean-Marc Strauven
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
See Also
- laravel-api-idempotency - API idempotency support
- laravel-apiroute - API versioning lifecycle management
All versions of laravel-api-throttle-smart with dependencies
illuminate/contracts Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/cache Version ^11.0|^12.0
illuminate/redis Version ^11.0|^12.0