guzzle/parser
guzzle/parser provides lightweight message parsing utilities for Guzzle, helping you parse HTTP request/response messages, headers, and related components. Useful when working with raw HTTP strings or building tooling around Guzzle’s message format.
guzzle/parser package is a lightweight, focused library for parsing HTTP-related data (cookies, messages, URIs, templates). It aligns well with Laravel’s HTTP-centric architecture, particularly for:
Illuminate\Http\Request/Response but offers lower-level control for edge cases.HttpClient (Guzzle-based) for pre/post-processing.HttpClient (Guzzle 6/7) or standalone Guzzle instances.Guzzle\Parser\Cookie) for Guzzle 6/7 equivalents.str()->of() for URIs). Evaluate if this package adds unique value.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Guzzle Version Mismatch | High | Create a compatibility shim or use a modern alternative (e.g., symfony/psr-http-message). |
| Deprecation Risk | Medium | Monitor Guzzle 3’s status; plan migration to Guzzle 7’s built-in parsers. |
| Performance Overhead | Low | Benchmark against Laravel’s native parsers (e.g., parse_url()). |
| Maintenance Burden | Medium | Assign ownership to a team member; document adapter layer. |
symfony/psr-http-message or Laravel’s built-in tools suffice?HttpTestCase)?Request objects).HttpClient.Request pipeline.| Laravel Component | Integration Point | Notes |
|---|---|---|
HttpClient |
Pre/Post request hooks | Use withOptions() or middleware. |
Illuminate\Http\Request |
Custom middleware | Parse cookies/headers early. |
Route |
URI template resolution | Replace Route::bind() logic. |
Session |
Cookie encoding/decoding | Extend SessionGuard. |
app/Http/Middleware/).Guzzle3ParserAdapter class to bridge Guzzle 3 methods to Guzzle 6/7:
class Guzzle3ParserAdapter {
public function parseCookie(string $cookie): array {
return (new Guzzle3CookieParser())->parse($cookie); // Hypothetical
}
}
parse_url()) only where justified.Psr7 parsers or Symfony components in 6–12 months.symfony/psr-http-message).UriTemplate may not align with modern PSR-7 standards.Psr\Http\Message) for future-proofing.README.md or ARCHITECTURE.md.3.9.5) to avoid breaking changes.guzzle/parser:^3.9 to composer.json with replace directives if using modern Guzzle:
"replace": {
"guzzle/parser": "guzzlehttp/psr7:^1.8"
}
Monolog).guzzle/parser repo for critical bugs.memory_get_usage() in high-load scenarios.| Scenario | Impact | Mitigation |
|---|---|---|
| Guzzle 3 parsing throws exception | HTTP request/response fails | Fallback to native PHP functions. |
| Guzzle 3 deprecation | Breaking changes in future | Migrate to Guzzle 7’s parsers. |
| URI template malformation | API routes fail to resolve | Validate templates before use. |
| Cookie parsing edge cases | Auth failures | Extend tests for RFC 6265 compliance. |
CONTRIBUTING.md.How can I help you explore Laravel packages today?