wandu/http
wandu/http is a lightweight HTTP component for PHP, offering request/response abstractions and helpers for headers, cookies, and common web interactions. It provides a clean, framework-friendly foundation for building HTTP applications in Wandu or standalone projects.
Treat wandu/http as a small outbound HTTP client plus request/response value objects, not as a replacement for Laravel's HTTP layer. Laravel already gives you Illuminate\Http\Request (Symfony-backed) for inbound traffic and Illuminate\Support\Facades\Http (Guzzle-backed) for outbound calls. The realistic entry point for this package is a narrow outbound integration in a legacy or framework-agnostic service class where you don't want a Guzzle dependency chain.
Minimal steps:
composer require wandu/http in a scratch project on the exact PHP version your app uses (7.4, 8.1, 8.2…). If it fails on deprecations or reserved-word conflicts, stop there — do not force it into a Laravel app you have to maintain.src/ before the README. For a package this small and this old, the classes themselves are the documentation. Look for the request, response, header, URI/query, and client classes; the header and query helpers are the parts the description actually promises, and they are usually the most self-explanatory.tests/ is the only reliable source of intended usage — especially for how headers are set/merged and how a client call is issued.If you only need one call, write Http::withHeaders(...)->get(...) and skip the package. Adopt it only if you specifically want its request/response/header abstractions outside of Laravel's helpers.
Bind it behind your own interface. Never let Wandu\Http\* types appear in controllers, jobs, or domain services. Define App\Contracts\ApiClient with methods like fetchUser(int $id): array, implement it with WanduHttpApiClient, and bind it in a service provider. This is the single most important pattern given the package's archived status — it makes replacement a one-line container change.
Adapter at the boundary. Convert in both directions inside the adapter: Laravel/Symfony request data → package request object, and package response → PSR-7-ish or plain arrays. If you need PSR-7 interoperability, do the conversion explicitly rather than type-hinting PSR interfaces; "PSR-friendly" in the description is not a guarantee of PSR-7 conformance, and this package predates widespread PSR-7 adoption.
Use the header/query helpers for the boring parts. The genuine value here is assembling multi-value headers and encoding query strings without hand-rolling http_build_query. Centralize those helpers in the adapter so signature generation, API keys, and Accept headers are built in exactly one place.
Configuration through Laravel config, not package globals. Put base URL, timeout, and credentials in config/services.php under a named entry, and read them in the service provider when constructing the client. Avoid static/global configuration if the package offers it — it makes tests order-dependent.
Testing pattern. Because you hid the package behind an interface, tests bind a fake implementation and never hit the network. For the adapter itself, keep one small integration test against a local stub server so upgrades or PHP bumps surface breakage immediately.
Keep it at the edge. Do not use the package's request/response objects as your application's transport types. Map to DTOs in the adapter; this also protects you from body-stream consumption quirks and header-case differences leaking into business logic.
Psr\Http\Message\RequestInterface against these objects without verifying. Assume incompatibility and write explicit conversion.each()/create_function() style helpers. Run the full suite on your target PHP before merging anything.Accept, Set-Cookie) are represented. Always read headers through a case-insensitive accessor, never by array key.http_build_query defaults to PHP_QUERY_RFC1738 (spaces as +). APIs that expect RFC 3986 (%20) will silently misbehave. Confirm which encoding the helper uses and override if necessary.Log::debug() of the fully-built URL, method, and header names (redact secrets) right before sending, and the status plus body length after. When something fails silently in a package this old, raw request/response dumps are faster than stepping through the source.Illuminate\Support\Facades\Http is the better default: maintained, testable via Http::fake(), and already in the framework. If you adopt wandu/http, write the adapter so migrating back is an afternoon's work, not a refactor.How can I help you explore Laravel packages today?