Video Version of the Lesson
[Only for premium members]
[Only for premium members]
In this final lesson of the course, we will have a "rapid fire" style list of various techniques, less-known syntax options and methods of Laravel HTTP Client. Let's go!
// Retry API calls with increasing delays (100ms, 200ms, 400ms)$response = Http::retry(3, 100, function ($exception, $request) { // Only retry on server errors or network issues return $exception instanceof ConnectionException || ($exception instanceof RequestException && $exception->response->serverError());})->get('https://api.unstable-service.com/data');
// Retry only on specific HTTP status codes$response = Http::retry(3, 1000, function ($exception, $request) { if ($exception instanceof RequestException) { $status = $exception->response->status(); // Retry on rate limiting (429) or server errors (5xx) return $status === 429 || $status >= 500; } return false;})->post('https://api.github.com/user/repos', $repoData);
...