friendsofouro/http-batch-guzzle
A Laravel/PHP package for batching HTTP requests with Guzzle, letting you group multiple calls and handle responses together for more efficient endpoint interactions.
Architecture fit: RecordingHttpClient is a test-double implementation of the package's existing ClientInterface, so it slots into the same seam the production batch client occupies. It does not alter the production request path, does not change the service provider or configuration surface, and is additive by construction. For a Laravel codebase, that means adoption is a container-binding swap inside tests rather than an architectural change. It records requests, responses, and exceptions, exposes filtering and chronological history — useful for classes that orchestrate multi-endpoint fan-out where Http::fake() alone gives poor visibility into batch sequencing.
Integration feasibility: High. Minor version bump (v3.0.0 → v3.1.0), no breaking changes, no migration steps, no new required configuration. The effort is almost entirely test-code and convention work rather than application work. The main feasibility question is whether the spy can be bound cleanly for the classes that matter (constructor-injected ClientInterface consumers) versus code that resolves the client inline.
Technical risk: Low overall, but non-zero in four areas:
Key questions:
Http::fake() and Laravel's HTTP client, or is it strictly scoped to this package's ClientInterface?Stack fit: Composer-managed Laravel application, PHPUnit or Pest suite. The spy is bound in the test container wherever a class depends on the batch client interface. It complements rather than replaces Http::fake(): use Http::fake() for single-request, facade-driven code and the spy for code that fans out through the batch client. Teams should be explicit about which mechanism governs which layer to avoid two competing fakes in one test.
Migration path: Update the constraint to ^3.1.0, run the existing suite unchanged to confirm the bump is inert, then introduce the spy incrementally in new tests and in tests that are currently flaky or under-asserted. No application code changes are required. Retiring existing hand-rolled mocks should be a deliberate follow-up, not part of the upgrade.
Compatibility: Confirm the PHP and Laravel matrix against our runtime before merging; the release notes assert compatibility with existing ClientInterface implementations, which is the compatibility claim that matters most. Verify PHPUnit/Pest versions in CI. Because this is a test-only addition, runtime compatibility risk is confined to the dev dependency graph — but dependency resolution failures in CI still block the pipeline.
Sequencing:
^3.1.0 on a branch; full suite must pass with zero test changes. This is the gate.Http::fake(), what not to assert on.Maintenance: Negligible production maintenance — the code path is test-only. The recurring cost is dependency hygiene: pin, track upstream 3.x releases, and watch for changes to the inspection API. Budget a small monthly review rather than a project.
Support: The support burden is pedagogical, not technical. Developers unfamiliar with spy-style testing will over-assert on full recorded payloads, producing brittle tests that break on unrelated field changes. Mitigate with review guidance favoring assertions on method, URL, and key fields over whole-body equality. Central ownership should sit with the platform/QA enablement function, not individual feature teams.
Scaling: Two scaling concerns. First, CI memory and runtime: recordings are held per test, and large batch payloads multiply quickly across a parallel suite. Keep fixtures small and avoid retaining recordings beyond the assertion. Second, organizational scaling: conventions must be documented before the pattern spreads, or each team will invent its own assertion style and the suite becomes inconsistent.
Failure modes:
Http::fake() are both active in one test, yielding confusing or order-dependent results.Ramp-up: Under an hour for a Laravel developer to write a first passing test; roughly one sprint to standardize conventions, redaction, and review guidance across a repository. The learning curve is shallow — the real investment is governance, not skill acquisition.
How can I help you explore Laravel packages today?