Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Http Laravel Package

amphp/http

Event-driven HTTP primitives for PHP 8.1+ in the AMPHP ecosystem. Provides shared building blocks for HTTP clients and servers, including IANA status codes with default reasons, RFC 6265 cookie parsing/creation (Set-Cookie/Cookie), and header utilities.

View on GitHub
Deep Wiki
Context7

Getting Started

This package provides low-level HTTP abstractions (like Request, Response, Headers, Message, Status) — not a full framework or standalone HTTP server/client. Start by examining src/Request.php, src/Response.php, and src/Status.php to understand the core types. Use it when building your own HTTP client/server libraries (e.g., over Amp’s event loop), where interoperability with PSR-7/15/17 is desired. First use case: normalize incoming requests in a custom HTTP server implementation by wrapping raw server data in Amp\Http\Message types.

Implementation Patterns

  • Composable layers: Wrap this package in custom middleware or server adapters (e.g., convert Amp’s ServerRequestAmp\Http\Message\Request).
  • PSR interoperability: Use the Amp\Http\Psr adapter (if present) to translate between PSR-7/17 and Amp’s native types — ideal for hybrid libraries.
  • Streaming payloads: Leverage Amp\Http\Message\Stream for efficient memory-constrained transfers (e.g., proxying large files or SSE streams).
  • Testing: Mock Request/Response directly in unit tests without touching nette/tester or Guzzle — e.g., $request = new Request('GET', '/health');.

Gotchas and Tips

  • No runtime logic: This is only data structures — no sending/receiving over sockets. You’ll need amphp/artax (client) or amphp/http-server for full stacks.
  • Header case sensitivity: Headers are normalized to canonical case internally; avoid manual string comparisons. Use $headers->get('Content-Type') instead of $headers['content-type'].
  • Stream ownership: Stream instances are often non-seekable or non-readable after read — never assume rewinding is safe unless documented (e.g., BufferedStream).
  • Extension point: Extend Message to add project-specific metadata (e.g., TrackedRequest extends Request) for logging/tracing — avoid mutating core classes directly.
  • Silent PSR fallbacks: If PSR-7/17 is unavailable at runtime, some adapters may silently fail — always declare both amphp/http and a PSR implementation (e.g., nyholm/psr7) in require/require-dev.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope