laravel:http-client-resilience
26
总安装量
15
周安装量
#14479
全站排名
安装命令
npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel:http-client-resilience
Agent 安装分布
claude-code
12
gemini-cli
8
opencode
7
windsurf
6
antigravity
5
Skill 文档
HTTP Client Resilience
Design outbound calls to be predictable and observable.
Commands
use Illuminate\Support\Facades\Http;
$res = Http::baseUrl(config('services.foo.url'))
->timeout(5)
->retry(3, 200, throw: false)
->withHeaders(['Accept' => 'application/json'])
->get('/v1/things', ['q' => 'bar']);
if (!$res->successful()) {
Log::warning('foo api failure', [
'status' => $res->status(),
'body' => substr($res->body(), 0, 500),
]);
}
Patterns
- Set timeouts explicitly (client and server defaults differ)
- Use limited retries with backoff for transient failures only
- Prefer dependency injection for testability
- Add request/response context to logs (redact sensitive data)
- Use
pool()for concurrency when calling multiple endpoints