Laravel HTTP client retry and timeout for external API calls
PHP Dasun Kalupahana 109 views
<?php
use Illuminate\Support\Facades\Http;
$response = Http::timeout(10)
->retry(3, 200) // 3 attempts, wait 200 ms between them
->acceptJson()
->get('https://api.example.com/users', ['page' => 1])
->throw();
$users = $response->json();
Calls an external API with a timeout and automatic retries. throw() raises an exception on 4xx and 5xx responses so failures aren’t silent.
Learn more on the blog
MySQL
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
8 min read
PHP
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...
9 min read
Docker
Docker Build Too Slow? 10 Ways to Speed It Up
A slow Docker build usually has one of a few causes: you...
8 min read