- How do I install Zttp with Composer in a Laravel app?
- Run composer require kitetail/zttp and start calling Zttp::get() and the other verb methods. No service provider is required, and registering the facade alias is optional. On Laravel 7 or newer, first check whether you need it at all, since the built-in Http facade provides a near-identical API.
- Does Zttp work with Laravel 7, 8, 9, 10, 11 or 12?
- Zttp targets Laravel 6 and older on PHP 7.x, and its last release dates to June 2019. It has not been validated against PHP 8.1, 8.2 or 8.3 semantics, so deprecation notices or typing issues are plausible. On Laravel 7 and newer, use Illuminate\Support\Facades\Http instead, because Zttp's API was absorbed into the framework.
- Does Zttp support Guzzle 7, or is it pinned to Guzzle 6?
- Zttp is built on guzzlehttp/guzzle ^6.x, and Guzzle 6 is end of life, so it will not resolve alongside dependencies that require Guzzle 7. Run composer why-not guzzlehttp/guzzle 7 to inspect your dependency tree before adopting it. If another SDK in your project needs Guzzle 7, Zttp is not a safe fit.
- How do I send a JSON POST request with Zttp?
- Call Zttp::asJson()->post($url, $payload) to send a JSON body with the correct content type. The returned response exposes ->body(), ->json() and ->status() for reading the result. For form-encoded bodies, swap asJson() for asFormParams().
- How do I add headers, bearer tokens or basic auth in Zttp?
- Chain withHeaders(['X-Key' => 'value']), withToken($token) for bearer auth, or withBasicAuth($user, $pass) before the verb call. These builders return the fluent instance, so they compose with asJson() and timeout(). The headers apply only to that request.
- How do I set a timeout or disable redirects in Zttp?
- Use ->timeout($seconds) to set a request timeout and ->withoutRedirecting() to stop Guzzle following redirects. Both are chainable before the verb method. Options such as connect_timeout, verify or proxy depend on whether a custom Guzzle client or handler stack can be injected.
- How does Zttp handle 4xx and 5xx error responses?
- Confirm this in your own tests: Zttp may either throw a Guzzle RequestException on 4xx/5xx or return a populated ZttpResponse, and the package documentation is the authority. Call sites that assume the opposite behavior can silently swallow failures. Always check ->isOk() or ->status() explicitly rather than relying on the absence of an exception.
- Can I mock or fake Zttp requests in tests?
- Mocking depends on whether you can inject a Guzzle client or handler stack, which is the key escape hatch to verify. Without it you cannot use Guzzle's MockHandler, set proxies or custom CAs, or attach tracing middleware. If testability matters, Laravel's Http facade offers Http::fake() out of the box.
- Does Zttp support async or concurrent HTTP requests?
- Zttp exposes no first-class async or Pool API, so fan-out patterns degrade into sequential N+1 outbound calls. That shows up as latency rather than an error. If any current or planned flow needs concurrent requests, use Guzzle directly or Laravel's Http pool support.
- Is Zttp still maintained, or should I use Laravel's HTTP client instead?
- Zttp's last release was 2019-06-10 and there is no security-response process, so treat it as a legacy shim rather than a forward-looking dependency. Every future Guzzle advisory becomes your incident to resolve. For Laravel 7 and newer, the correct answer is usually to adopt the first-party Http facade and remove Zttp.