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
Guzzle Advanced Throttle

Guzzle Advanced Throttle Laravel Package

hamburgscleanest/guzzle-advanced-throttle

Advanced Throttle adds flexible rate-limiting middleware to Guzzle, letting PHP and Laravel apps enforce multiple request limits, use cache or Redis storage, and avoid API overages with configurable buckets, per-host rules, and smooth request spacing. Ideal for reliable API clients.

View on GitHub
Deep Wiki
Context7

A Guzzle middleware that can throttle requests according to (multiple) defined rules. It is also possible to define a caching strategy, e.g. get response from cache when rate limit is exceeded or always get cached value to spare your rate limits.

Frequently asked questions about Guzzle Advanced Throttle
How do I install hamburgscleanest/guzzle-advanced-throttle in Laravel?
Install it with Composer using composer require hamburgscleanest/guzzle-advanced-throttle. Laravel package auto-discovery registers the service provider, then you publish the config, define your rate-limit rules, and add the middleware to the relevant Guzzle HandlerStack.
Does guzzle-advanced-throttle support Laravel 8, 9, and 10 with Guzzle 7?
The package is aimed at Laravel applications using Guzzle 7 and fits naturally with Laravel 8 through 10. Always check the Composer constraints for your exact Laravel and PHP versions before upgrading, since the package has a single-maintainer risk profile.
Can I define multiple rate-limit rules for one API client?
Yes, the middleware is built around multiple named rules, so one client can enforce several limits at once. You can combine linear rules with header-driven rules and apply per-host rules, which is useful when an upstream has separate quotas for different endpoints or credentials.
What cache driver should I use for throttle counters in production?
Use a shared cache store such as Redis or Memcached for throttle counters, not the file or array driver. File and array counters are per-process, so concurrent PHP-FPM or queue workers will not enforce a meaningful global limit. The package has a pluggable cache strategy, so configure the shared store explicitly per upstream.
Does it honor X-RateLimit headers or Retry-After from the API?
The rule abstraction supports both static or linear limits and header-driven rate-limit rules, so vendor X-RateLimit-* values can inform throttling. Retry-After behavior is not clearly guaranteed by the package overview, so test it against your specific upstream before depending on it. If the vendor headers are inconsistent, fall back to conservative static rules.
How does it integrate with Laravel's Http facade?
Laravel's Http facade builds its own Guzzle client, so the middleware is not automatically in that stack. Create a dedicated client class or container binding that configures GuzzleHttp\Client with the throttle middleware, and use that wrapper for the upstream. This also keeps the middleware as an implementation detail you can replace later.
What happens when the rate limit is exceeded: does it block or return a cached response?
When a rule is exceeded, the package can serve a cached response instead of making the live call, or you can configure it to always return cached values to spare quota. Some setups may also block and wait, which holds a worker for the duration and can turn a rate-limit issue into a capacity issue. Choose fail-fast plus queueing or blocking deliberately, and test the behavior under load.
Is guzzle-advanced-throttle safe with concurrent queue workers and high traffic?
The main concurrency risk is counter atomicity: if the implementation does read-modify-write against the cache instead of an atomic increment, concurrent workers can overshoot the limit. Use a shared cache store and load-test with real worker concurrency against a test quota before trusting it in production. Also confirm whether a cache outage fails open or closed for your use case.
How should I order the throttle middleware with Guzzle retry middleware?
Middleware ordering matters because retries handled outside the throttle can bypass the bucket and blow the upstream quota. Put the retry middleware inside the throttle, or otherwise ensure every retry attempt is counted by the rate-limit rules. Test this with deliberate 429 or 5xx responses from a mock upstream.
Is hamburgscleanest/guzzle-advanced-throttle actively maintained, or should we fork it?
The package currently has zero dependents and no meaningful star history, so treat it as a single-maintainer dependency with limited production evidence. If it is critical to your API clients, be prepared to fork and vendor it internally, and assign an owner. Run composer audit and verify PHP and Guzzle compatibility as part of that decision.
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