Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ratelimit Laravel Package

nonanerz/ratelimit

Lightweight rate limiting for Laravel applications. Add middleware to throttle requests, define custom limits for routes and APIs, and protect your app from abuse with cache-backed counters. Simple configuration and easy integration.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Ratelimit
How do I install nonanerz/ratelimit in a Laravel app?
Install the package with Composer using composer require nonanerz/ratelimit. Then follow the repository README for any service provider registration or configuration publishing steps. After installation, you can attach the middleware to the routes or route groups you want to throttle.
Which Laravel and PHP versions does nonanerz/ratelimit support?
The package is built for Laravel applications, but exact version constraints are defined in its composer.json. Check the GitHub repository requirements before installing to confirm compatibility with your Laravel and PHP versions. This is especially important if you are on an older or newly released Laravel release.
How do I apply the rate limiting middleware to Laravel routes?
Add the package's rate limiting middleware to individual routes, route groups, or your HTTP kernel alias as described in the README. Middleware can be applied in your routes files or via the kernel depending on how the package is registered. This lets you throttle only the endpoints that need protection.
Can I define custom rate limits for specific routes and API endpoints?
Yes, the package is designed for custom limits on routes and APIs. You define the thresholds through the package configuration or middleware parameters as documented. This allows different limits for public endpoints, authenticated APIs, and sensitive actions.
How does the cache-backed counter work in nonanerz/ratelimit?
The package stores request counters in Laravel's cache, so the cache store configured in your application is used. For multi-server or production setups, use a shared cache store such as Redis or the database driver instead of a local file cache. This keeps counters consistent across application instances.
Can I rate limit by user, IP address, or API token?
Rate limiting typically keys counters by request attributes such as the client IP or authenticated user. Check the package configuration and middleware options for customizing the key used for throttling. This lets you choose the right identity for web routes, APIs, and authenticated users.
Does nonanerz/ratelimit work alongside Laravel's built-in throttle middleware?
The package can generally be used alongside Laravel's native throttle middleware, but avoid applying both to the same routes unless you intentionally want layered limits. Evaluate whether you need Laravel's built-in limiter or the package's custom route and API configuration. Using one clear throttling layer usually keeps behavior easier to reason about.
How do I test rate limiting in a Laravel application?
Use Laravel's HTTP testing helpers to hit a route repeatedly and assert the throttled response. Set a low limit in your test configuration and clear the relevant cache between tests so counters do not leak. This helps verify both the allowed and blocked request paths.
What response is returned when a request exceeds the rate limit?
When the limit is exceeded, the middleware blocks the request, typically with an HTTP 429 Too Many Requests response. Check the package source or README for any retry headers or custom response behavior. You can then decide whether to customize the response for your API consumers.
Is nonanerz/ratelimit actively maintained, and what are the alternatives?
Check the GitHub repository's commit history, release tags, and issue activity to judge current maintenance. Laravel's built-in throttle middleware is a common alternative if you only need basic request limiting. This package is a good fit when you want lightweight, configurable, cache-backed limits for routes and APIs.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections