hoa/http
Hoa\Http is a PHP library for manipulating HTTP messages, with abstractions for requests and responses plus tools for building HTTP clients and servers. As part of the modular Hoa project, it offers reusable components for handling HTTP protocol details in PHP applications.
hoa/http is a small, low-level HTTP message library from the Hoa project: request/response abstractions, URL handling, cookies, and a client built on Hoa’s stream stack. It is archived, last released in 2017, has 10 stars and 0 dependents. Treat it as legacy infrastructure, not a foundation for new Laravel work.
Minimal evaluation steps:
composer require hoa/http
# or, if Composer refuses on your PHP version:
composer require hoa/http --ignore-platform-reqs
Then look first at:
vendor/hoa/http/Request.php — request construction, method, URL, headers, bodyvendor/hoa/http/Response.php — status, headers, bodyvendor/hoa/http/Url.php — URL parsing and query manipulationvendor/hoa/http/Client.php — transport wrapper, if present in your installed versionvendor/hoa/http/composer.json — Hoa\Stream, Hoa\Protocol, Hoa\Event, Hoa\Consistency dependenciesvendor/hoa/http/Test/Unit — the most reliable API documentation for an archived packageDo not assume PSR-7 or PSR-18 method names. The API is Hoa-specific and small enough to read directly before writing code.
The most realistic first use case for a Laravel developer is not replacing Illuminate\Support\Facades\Http. It is either:
Hoa\Http\Request/Response objects, orHoa\Http\Url as a quick URL parser in a legacy script.For anything greenfield, the first use case should be: “wrap this behind an adapter so it can be removed later.”
use Hoa\Http\Url;
$url = new Url('https://api.example.com/v1/users?page=2');
// Inspect available getters in Url.php before relying on them.
Adapter around the client. Never inject Hoa\Http\Client, Request, or Response directly into controllers, jobs, or domain services. Create one boundary class that owns all Hoa types and exposes Laravel-friendly arrays or DTOs.
namespace App\Support\Http;
final class LegacyHoaGateway
{
public function get(string $path, array $query = []): array
{
// Build Hoa request, send, and normalize response here.
// Return ['status' => ..., 'headers' => ..., 'body' => ...].
}
}
Bind this class in a service provider and let the rest of the application depend on your interface, not on Hoa.
Centralize request construction. Put base URL, auth headers, user agent, timeouts, and default query parameters in one builder. Hoa gives you message objects, not a full HTTP client policy layer, so retries, backoff, logging, and header defaults are your responsibility.
Normalize responses immediately. Convert Hoa responses to Laravel response() objects, arrays, or typed DTOs at the boundary. Do not return Hoa response objects from controllers; they are not compatible with Laravel’s response pipeline, testing helpers, or middleware.
Use it for URL/value-object work only where safe. If you only need URL parsing or query manipulation, isolate Hoa\Http\Url usage. If you need transport, be aware that Hoa’s client is stream-based and does not provide Guzzle-style middleware, retries, connection pooling, or PSR-18 interoperability.
Testing pattern. Because Laravel’s Http::fake() will not intercept Hoa calls, your adapter should be fakeable at your own boundary. In unit tests, construct Hoa Response objects with fixed status/headers/body and feed them to the adapter, or bind a fake gateway implementation. Do not let tests make real outbound calls.
Migration workflow. If you inherit a codebase using hoa/http, inventory every usage, move it behind an adapter, then replace the adapter internals with Laravel’s HTTP client or Guzzle. Keep Hoa only for parsing if absolutely necessary, and mark it as a temporary dependency.
Integration tip: avoid mixing stacks. Do not use hoa/http alongside Guzzle or Laravel’s HTTP client for the same endpoint set. Different redirect, cookie, TLS, timeout, and error semantics will create inconsistent behaviour that is hard to debug.
--ignore-platform-reqs may install it but does not make it safe.getHeaders() output rather than assuming a shape.http_build_query() and test array parameters, nested parameters, and already-encoded values. Do not assume Guzzle-compatible URL encoding.composer why hoa/http and avoid mixing Hoa versions across the application.Request/Response or wrapping the client is possible, but you are extending an abandoned API. Keep extensions inside your adapter and avoid spreading Hoa types through the codebase.Illuminate\Support\Facades\Http or Guzzle for new work. If hoa/http already exists, isolate it, test it hard, and schedule removal; its low adoption and archived status make it a liability rather than a day-to-day productivity tool.How can I help you explore Laravel packages today?