Pros:
Cons:
Kernel::terminate vs. Symfony’s kernel.terminate).spatie/rate-limiter).EventDispatcher; Laravel’s events facade can bridge this with minor abstraction (e.g., Illuminate\Events\Dispatcher).RouteServiceProvider may require custom bootstrapping.OkaRateLimit\Storage\StorageInterface.Illuminate\Cache) could be adapted, but no out-of-the-box support.throttle or spatie/rate-limiter). Requires careful sequencing.X-RateLimit-Remaining).RequestContext may not map cleanly to Laravel’s Request object.spatie/rate-limiter implementation ready if issues arise.throttle middleware if both are enabled? Will we need a composite solution?rate_limit_hits_total) for Prometheus, or will we need custom instrumentation?symfony/event-dispatcher as a bridge (already in Laravel’s vendor tree). Override AppServiceProvider::boot() to register the bundle’s listener.RequestStack → Laravel’s Request).Illuminate\Cache\Repository) as a drop-in storage backend (requires implementing StorageInterface).predis/predis (preferred for distributed systems).App\Http\Middleware\ThrottleRequests to avoid conflicts.// app/Providers/EventServiceProvider.php
protected $listen = [
'kernel.request' => [
\OkaRateLimit\EventListener\RateLimitListener::class,
],
];
ab (Apache Bench) or k6 to validate rate-limiting behavior.StorageInterface for Redis or database. Example:
class RedisRateLimitStorage implements StorageInterface {
use \Illuminate\Contracts\Redis\Lockable;
public function increment($key) { ... }
public function get($key) { ... }
}
$this->app->bind(
\OkaRateLimit\Storage\StorageInterface::class,
RedisRateLimitStorage::class
);
/api/auth/login).RateLimitExceededException or storage-related failures.RequestContext may need adaptation for Laravel’s Request lifecycle (e.g., terminate events).spatie/rate-limiter or laravel/throttle. Use feature flags to toggle between solutions.symfony/event-dispatcher and symfony/http-foundation are installed (Laravel includes these).spatie/circuit-breaker) for storage failures.spatie/rate-limiter) if SLAs are required.memory_get_usage().RATELIMIT commands or Lua scripts.spatie/circuit-breaker to degrade gracefully if storage fails.How can I help you explore Laravel packages today?