- 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.