0048-laravel-http-client-resilience

Configure Laravel HTTP client timeouts, retries, and failure logging.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0048-laravel-http-client-resilience
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 0048-laravel-http-client-resilience
Source: https://github.com/MrJmpl3/codex_____data_____configuration/tree/main/skills/0048-laravel-http-client-resilience
Command: npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0048-laravel-http-client-resilience

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Outbound HTTP requests can fail unpredictably due to timeouts, transient network issues, or unstable upstream services, leading to unclear behavior and hard-to-debug outages.

Core Features & Use Cases

  • Explicit timeouts and bounded retries: Apply a timeout and a limited retry strategy with backoff to handle transient failures safely.
  • Failure-aware handling with observable context: Log request/response context when responses are not successful, capturing status and a safe excerpt of the body for diagnostics.
  • Scoped configuration for clean request building: Use base URLs, headers, and request parameters in a single, consistent call flow for typical API consumption scenarios (e.g., fetching resources from a JSON API).

Quick Start

Update your Laravel HTTP client code to set a timeout, add a limited retry with backoff, and log status plus a truncated response body whenever the call is unsuccessful.

Frequently Asked Questions about 0048-laravel-http-client-resilience

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle HTTP client timeouts and transient failures in Laravel?

To handle HTTP client timeouts and transient failures in Laravel, you apply explicit timeout limits and bounded retries with exponential backoff to your outbound HTTP requests. This ensures predictable behavior when external JSON endpoints are unstable.

How do I add retry and backoff strategies to Laravel HTTP client requests?

You add retry and backoff to Laravel HTTP client requests by configuring a limited retry strategy during the Http call. This bounds the retry attempts and applies backoff delays to safely recover from transient network issues.

What is the best way to log failed outbound HTTP requests for diagnostics in Laravel?

The best way to log failed outbound HTTP requests in Laravel is to capture context-rich logs upon unsuccessful responses, recording the HTTP status and a safe truncated excerpt of the response body for deterministic production diagnostics.

Can I use Laravel HTTP client for API integrations that require predictable failure handling?

Yes, you can use the Laravel HTTP client for API integrations requiring predictable failure handling. It supports scoped configuration like base URLs and headers alongside structured failure responses, ensuring deterministic diagnostics for external JSON API consumption.

Why do my Laravel HTTP calls fail unpredictably when calling external JSON APIs?

Laravel HTTP calls fail unpredictably due to transient network issues, unhandled timeouts, or unstable upstream services. Without explicit timeouts and bounded retry strategies, these transient failures lead to unclear behavior and hard-to-debug outages.

Are unbounded retries recommended when handling external API failures in Laravel?

Unbounded retries are not recommended for external API failures in Laravel. You should enforce bounded retries with backoff and context-rich logging of failures to prevent cascading timeouts and support safe response inspection.