jcchavezs/httptest
Spin up a lightweight local HTTP server for integration testing real HTTP calls (e.g., cURL). Define a request handler to assert method/headers/body and craft responses, enabling client- and server-side assertions without mocking HTTP.
Http::fake() or manual assertions.Http::fake() for more expressive assertions (e.g., "this endpoint must return a 401 when auth fails").Adopt if:
Look elsewhere if:
For Executives: *"This package lets our engineering team automate and accelerate HTTP API testing without relying on manual tools or external services. By integrating it into our Laravel test suite, we can:
Risk: The package is unmaintained (last release 2018), but its core functionality is stable for basic HTTP testing. We’d mitigate this by:
For Engineering: *"httptest is a minimalist PHP library to assert HTTP interactions in Laravel tests. Key benefits:
Http::fake(): More expressive assertions (e.g., assertRequestCount(2) + payload validation).TestCase, RefreshDatabase, etc.Example use case:
// Test a payment webhook
$response = $this->post('/webhook/payment', ['amount' => 100]);
httptest()->assertRequest()
->wasSentTo('/stripe/confirm')
->withHeaders(['Authorization' => 'Bearer token'])
->withJson(['amount' => 100]);
Tradeoffs:
Proposal: Pilot this for internal API contract testing (e.g., service-to-service calls) before expanding to external integrations."*
How can I help you explore Laravel packages today?