Weave Code
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 Retry Middleware Laravel Package

caseyamcl/guzzle_retry_middleware

Guzzle middleware that automatically retries failed HTTP requests with configurable delays and retry conditions. Helps handle transient network errors, 5xx responses, and rate limiting with backoff strategies, improving resilience without changing client code.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Resilience in API integrations: Automatically handle transient failures (429 Too Many Requests, 503 Service Unavailable) without manual retry logic, improving uptime for API-dependent features. The updated delay mechanism (now using Guzzle’s options array) ensures non-blocking retries, critical for high-concurrency environments (e.g., webhooks, batch processing).
  • Cost optimization: Reduce unnecessary API calls by respecting rate limits (e.g., Retry-After headers) and avoiding throttling penalties, now with improved parallel-request compatibility.
  • Build vs. buy: Avoid reinventing retry logic (e.g., custom middleware or libraries like guzzlehttp/retry-middleware), saving dev time and reducing technical debt. The change to options-based delays aligns with Guzzle’s modern practices, reducing friction for integration.
  • Roadmap for reliability:
    • Concurrent API calls: Prioritize for features with parallel HTTP requests (e.g., bulk data syncs, real-time event processing).
    • High-traffic features: Payment processing, SaaS integrations, or marketplaces where blocking delays degrade performance.
    • Compliance-critical workflows: Webhooks or idempotent operations where retries prevent data loss.
  • Performance SLAs: Meet uptime guarantees by mitigating flaky responses, now without blocking threads during retries.

When to Consider This Package

  • Adopt if:

    • Your app relies on third-party APIs with rate limits or intermittent failures (e.g., Stripe, Twilio, internal microservices).
    • You’re using Guzzle v6/7+ and need a lightweight, battle-tested solution with non-blocking retries (critical for parallel requests).
    • Retries are critical but not business-logic-specific (e.g., don’t use for idempotent operations like payments without custom logic).
    • Your team lacks bandwidth to implement retry logic from scratch (e.g., while loops with exponential backoff).
    • You need simple, configurable retries with minimal overhead (e.g., max retries, delay, exception whitelisting).
  • Look elsewhere if:

    • You need advanced retry strategies (e.g., jitter, circuit breakers) → Consider guzzlehttp/retry-middleware or symfony/http-client.
    • Your API requires custom retry conditions (e.g., retry on 401 after refresh token) → Build or extend this package.
    • You’re using non-Guzzle HTTP clients (e.g., curl, HttpClient in Symfony).
    • Your app has strict latency requirements (retries add delay; evaluate trade-offs).
    • You need observability (this package lacks built-in metrics; pair with Prometheus or OpenTelemetry).
    • You’re running legacy Guzzle v5 (this change assumes v6/7+).

How to Pitch It (Stakeholders)

For Executives: "This package now handles API retries without blocking threads, making it ideal for high-concurrency systems like our [bulk data sync] or [real-time event processing]. For example, if our payment processor throttles requests during peak hours, this middleware will retry intelligently—without slowing down other API calls—saving dev time and keeping transactions flowing. It’s a low-risk, high-impact fix for API reliability, with zero performance overhead for parallel workloads. We’re proposing it for [Feature X], where [Y]% of API calls could benefit from non-blocking retries."

For Engineering: *"This update fixes a critical blocking issue in v2.12 and earlier: retries now use Guzzle’s options array for delays instead of usleep, preventing thread starvation in parallel request scenarios. Key benefits:

  • Non-blocking retries: Safe for concurrent HTTP calls (e.g., webhook batches, async jobs).
  • Plug-and-play: Replace Guzzle\Middleware::retry with this in 5 minutes—just update the options array:
    $client = new Client([
        'handler' => HandlerStack::create()->push(Middleware::retry()),
        'delay'   => 100, // Milliseconds (non-blocking)
    ]);
    
  • Configurable: Set max_retries, delay, and except (exceptions to skip) via options.
  • Maintained: Last updated in 2025 with 200+ stars; aligns with Guzzle’s modern API. Proposal: Add this to our HTTP client layer for all external API calls. Let’s prototype it for [API Y] and measure impact on error rates and latency under load."*
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity