---
title: "HTTP Client Rate Limits for Laravel — docs | Roundly"
description: "Docs for HTTP Client Rate Limits for Laravel: per-second to per-day limits, named profiles, compound windows, adaptive backoff, shared stores, testing."
url: https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

Open source

# HTTP Client Rate Limits for Laravel

Install

`composer require roundly-consulting/http-client-rate-limits-for-laravel`

Requires: PHP ^8.4 · Laravel ^12.0|^13.0

[GitHub](https://github.com/roundly-consulting/http-client-rate-limits-for-laravel) [Packagist](https://packagist.org/packages/roundly-consulting/http-client-rate-limits-for-laravel) [Donate (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Patreon](https://www.patreon.com/cw/roundly)

## Overview

Rate limit outgoing requests made with Laravel’s HTTP client. Declare a budget — per second, minute, hour or day — and a small Guzzle middleware paces your calls, waiting exactly as long as needed when the limit is reached, so you never blow past a third-party API’s quota. Every limit comes from one RateLimits facade, so the configured store — or a test fake — applies everywhere. Named profiles, compound windows, per-owner budgets, header-driven adaptive backoff and shared cache, Redis or database stores are built in. MIT-licensed and dependency-light: only official Laravel components plus three small Roundly packages.

### What you get

#### One-line throttling

Http::rateLimit(30) on any request, or build limits with the RateLimits facade or an injected manager. It waits exactly as long as needed, then sends.

#### Profiles & compound windows

Define limits once in config and reference them by name. Enforce 5/sec and 100/min at once — the strictest window wins.

#### Shared stores

In-memory, any Laravel cache, Redis or the database — each checks and records a request in one atomic step, so workers sharing a budget never overshoot it.

#### Adaptive backoff

Reads Retry-After and X-RateLimit-\* response headers and makes the next call wait exactly as long as the server asked.

#### Fail fast, jitter & queues

Cap the wait with a typed exception, spread wake-ups with jitter, or release queued jobs instead of blocking workers.

#### Events & testing fake

RequestDeferred, RequestAllowed and RateLimitReset events, plus a recording RateLimits::fake() with deferred, allowed and reset assertions.

### Documentation

#### [Installation](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/installation.md)

Install via Composer, optionally publish the config, and publish the migration only if you use the DatabaseStore.

#### [Configuration](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/configuration.md)

Every config key, its default and env variable — limiter profiles, default store and deferrer, cache, Redis, database and events.

#### [The RateLimits facade](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/facade.md)

The one entry point for building limits — per-window factories, profiles, compound limits, store and deferrer overrides, Retry-After, the fake.

#### [DI and actions](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/without-facade.md)

Inject RateLimitManager instead of calling the facade, or wire a RateLimit by hand — the package has no action classes.

#### [Rate limiting requests](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/rate-limiting-requests.md)

Throttle Laravel HTTP client calls with the Http::rateLimit() macro or the RateLimit Guzzle middleware, from per-second to per-day.

#### [Per-owner budgets](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/per-owner-budgets.md)

Scope a limit to an owner — an account, tenant, API key or outbound IP — so independent callers never share a budget.

#### [Named limiter profiles](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/named-profiles.md)

Define reusable limits once in config and reference them by name — Http::rateLimit('github') — with every option available.

#### [Compound limits](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/compound-limits.md)

Enforce several windows on one request — 5 per second and 100 per minute — where the strictest window decides the wait.

#### [Max wait & fail fast](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/max-wait.md)

Cap how long a call may wait; above the ceiling it throws RateLimitExceededException instead of blocking.

#### [Jitter](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/jitter.md)

Add random extra wait so a fleet of workers doesn’t wake up in lockstep — never less than the real wait; inject the randomness for tests.

#### [Adaptive limiting](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/adaptive-limiting.md)

Honour the server’s own budget — read Retry-After and X-RateLimit-\* headers and back off exactly as long as asked.

#### [Retry-After & 429 retries](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/retry-after.md)

Combine the limiter with Laravel’s retry() and RateLimits::retryAfter() to honour 429 Too Many Requests responses.

#### [Pre-flight inspection](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/inspection.md)

Ask how many requests remain and how long until the next is allowed — without recording a hit — and reset a key’s budget.

#### [Stores](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/stores.md)

Where request timestamps live — memory, any Laravel cache, Redis or the database — how each stays atomic, and how to write your own.

#### [Deferrers & queued jobs](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/deferrers.md)

How the wait is performed — a millisecond sleep by default, or releasing a queued job back onto the queue.

#### [Defaults & overrides](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/defaults.md)

Set the default store and deferrer in config, override them per call site with RateLimits::usingStore() / usingDeferrer(), or per instance.

#### [Events](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/events.md)

RequestDeferred, RequestAllowed and RateLimitReset events to log, chart or alert on throttling — or switch them off for zero overhead.

#### [Exceptions](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/exceptions.md)

Every typed exception the package throws, when it happens, and one base class to catch them all.

#### [Timespan enum](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/timespan-enum.md)

The Timespan enum behind every window — second to day — with the full enums-for-laravel toolkit for labels, options and validation.

#### [Testing](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/testing.md)

Swap in RateLimits::fake() to assert deferred, allowed and reset limits without real sleeps or Redis, or fake Laravel’s Sleep.

#### [Requirements](https://roundly-consulting.com/open-source/docs/http-client-rate-limits-for-laravel/requirements.md)

PHP 8.4+ and Laravel 12 or 13; Redis only for the RedisStore, two database tables only for the DatabaseStore.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source.md)
