Download the PHP package ahur-system/ai-rate-limiter without Composer
On this page you can find all versions of the php package ahur-system/ai-rate-limiter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ahur-system/ai-rate-limiter
More information about ahur-system/ai-rate-limiter
Files in ahur-system/ai-rate-limiter
Package ai-rate-limiter
Short Description Intelligent API Rate Limiting with AI-powered adaptive throttling
License MIT
Homepage https://github.com/yourusername/ai-rate-limiter
Informations about the package ai-rate-limiter
AI-Powered Rate Limiter for PHP
An innovative PHP rate limiting library that uses artificial intelligence to provide adaptive throttling based on usage patterns. This library goes beyond traditional rate limiting by learning from user behavior and optimizing limits in real-time.
โ ๏ธ Important Information
๐ค AI Implementation
This library uses AI concepts (pattern learning, adaptive algorithms, intelligent decision making) but does NOT require:
- โ No machine learning libraries
- โ No neural networks or deep learning
- โ No external AI services
- โ No complex ML algorithms
The "AI" is implemented through:
- Pattern Learning: Analyzes historical usage data
- Adaptive Algorithms: Dynamically adjusts limits based on behavior
- Intelligent Decision Making: Context-aware rate limiting
- Statistical Analysis: Trend calculation and burst detection
๐ Licensing
- MIT License: Completely free to use
- No License Key Required: No proprietary licensing system
- Open Source: Full source code available
- No Usage Limits: Use in any number of projects
- Commercial Use: Allowed for commercial applications
๐ Ready to Use
Simply install via Composer and start using immediately - no additional setup, licensing, or AI services required!
๐ Features
๐ค AI-Powered Intelligence
- Adaptive Rate Limiting: Automatically adjusts limits based on usage patterns
- Burst Detection: Intelligently detects and handles traffic bursts
- Pattern Learning: Learns from historical usage data to optimize performance
- Predictive Throttling: Anticipates usage patterns to prevent rate limit violations
๐ฏ Smart Features
- Multi-Tenant Support: Isolated rate limiting for different users/APIs
- Endpoint-Specific Limits: Different limits for different API endpoints
- Intelligent Retry Strategies: Multiple strategies (exponential, linear, fixed, jitter, adaptive)
- Real-time Analytics: Detailed usage statistics and trends
- HTTP Header Integration: Standard rate limiting headers for APIs
๐ง Technical Excellence
- High Performance: Redis-based storage for lightning-fast operations
- Memory Efficient: Automatic cleanup of old patterns
- Thread Safe: Designed for concurrent access
- Extensible: Easy to customize and extend
๐ฆ Installation
Requirements
- PHP 8.1 or higher
- Redis server
- PHP Redis extension
Composer Installation
Manual Installation
๐ Quick Start
๐ Usage Examples
Basic Rate Limiting
API Integration with Headers
Usage Statistics
Retry Strategies
The library supports multiple retry strategies for handling rate-limited requests:
Strategy Details:
- exponential: 60s, 120s, 240s, 480s... (recommended for APIs)
- linear: 60s, 120s, 180s, 240s... (predictable increases)
- fixed: Always 60s (simple and consistent)
- jitter: Exponential with ยฑ10% randomness (prevents thundering herd)
- adaptive: Based on usage patterns and historical data
Reset Rate Limits
๐๏ธ Architecture
Core Components
- AIRateLimiter: Main class handling rate limiting logic
- RateLimitResult: Encapsulates rate limiting results
- Pattern Analysis: AI algorithms for usage pattern detection
- Redis Storage: High-performance data storage
Data Flow
๐งช Testing
Run the test suite:
Run examples:
๐ Performance
Benchmarks
- Check Operation: ~0.1ms average response time
- Pattern Analysis: ~0.5ms for complex patterns
- Memory Usage: ~1KB per user pattern
- Redis Operations: 2-3 operations per check
Scalability
- Supports millions of concurrent users
- Horizontal scaling with Redis cluster
- Automatic cleanup of old patterns
- Efficient memory usage
๐ Security Features
- Isolation: Multi-tenant support with key isolation
- Validation: Input validation and sanitization
- Rate Limiting: Prevents abuse and DoS attacks
- Audit Trail: Detailed logging of rate limit decisions
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Inspired by modern AI/ML approaches to rate limiting
- Built for the PHP community
- Designed for high-performance applications
๐ Support
- Issues: GitHub Issues
- Documentation: Wiki
- Discussions: GitHub Discussions
Made with โค๏ธ for the PHP community
This innovative rate limiting solution combines the power of artificial intelligence with the simplicity of PHP to provide intelligent, adaptive API protection.
All versions of ai-rate-limiter with dependencies
ext-json Version *
ext-redis Version *