yiisoft/http
Lightweight HTTP utilities for PHP from the Yii ecosystem, offering constants for methods, status codes, headers, and MIME types plus helpers for PSR-7 messages. Useful for building consistent HTTP layers without a full framework.
Status::NOT_FOUND, Method::POST). This is a linting/standards decision, not a product feature, but it measurably reduces a class of API defects where the wrong code reaches a customer.Consider it when:
Look elsewhere when:
Illuminate\Http\Response, Symfony's Response constants, or PHP 8.1 backed enums you define yourself are equally capable and remove a dependency entirely.tryFrom() semantics, IDE autocomplete guarantees, or first-class static analysis integration — hand-rolled enums may serve better.For executives: This is a low-cost, low-risk hygiene dependency under a permissive BSD-3-Clause license. It reduces a specific, real defect class — incorrect HTTP status codes reaching customers — at essentially zero operational cost and no measurable performance impact. It is not a strategic bet and has no roadmap impact; the small community footprint (29 stars) means we should treat it as replaceable commodity code, not a platform commitment.
For engineering: Adopt it as a thin constants layer to standardize HTTP methods and status codes across PHP services, particularly where we want the same vocabulary inside and outside Laravel. The trade-off is honest: it duplicates what Laravel and Symfony already ship, so the win is portability and readability, not new capability. Because maintenance depth is shallow, we recommend pinning the version, wrapping imports behind our own façade (or forking outright if we depend on it broadly), and pairing adoption with a lint rule banning raw numeric status codes. If the team is Laravel-only, define PHP enums in-house and skip the dependency.
How can I help you explore Laravel packages today?