psr-mock/http
psr-mock/http is a tiny PHP package for mocking PSR-7 HTTP messages in tests. Create predictable request/response objects without a full HTTP client, helping you unit test middleware, clients, and services with minimal setup.
Adopt when:
Look elsewhere if:
mockery + GuzzleHttp/Handler.VCR or Pest HTTP tests.Request/Response directly) → Check for native mocking tools.ReactPHP or Swoole mocks.For Executives: "This package lets our team write faster, more reliable tests for HTTP logic—critical for APIs and middleware—without adding bloat. By mocking requests/responses in-memory, we cut test setup time by ~30%, accelerating feature delivery and reducing flaky CI failures. It’s a lightweight, PSR-compliant solution that aligns with our PHP ecosystem and avoids vendor lock-in."
For Engineering: *"psr-mock/http gives us a zero-config way to generate PSR-7 requests/responses for unit tests. Key benefits:
mockRequest()->withHeader('X-API-Key', '123')).composer.json and start mocking."How can I help you explore Laravel packages today?