Weave 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 Playback

Http Playback Laravel Package

garethp/http-playback

Record real HTTP responses once, then replay them deterministically in your PHP tests. GarethP's HTTP Playback makes it easy to capture and reuse external API interactions, keeping test suites fast, reliable, and free of network flakiness.

View on GitHub
Deep Wiki
Context7

garethp/http-playback is a lightweight PHP package for recording and replaying HTTP interactions, helping you build fast, deterministic tests without relying on external services. Capture real responses once, then replay them in later runs—ideal for integration tests, CI pipelines, and local development.

  • Record real HTTP traffic into reusable fixtures
  • Replay responses without network calls
  • Eliminate flaky external dependencies
  • Simple API for PHP and Laravel projects
  • Speeds up test suites and improves reliability
Frequently asked questions about Http Playback
What is garethp/http-playback and what problem does it solve?
It is a small MIT-licensed PHP library that wraps an HTTP client with recording and playback utilities. You capture real responses from an external API once, store them, and replay them on later runs so tests and local development stop depending on live network calls. The goal is deterministic, fast tests without hand-writing a mock for every request.
How do I install garethp/http-playback in a Laravel project?
It is Composer-installable and PSR-4 autoloaded, so installation is a composer require, ideally as a require-dev dependency since this is a test-time utility. There is no service provider or facade to register, so nothing needs to hook into Laravel's container. You construct the playback client in your test bootstrap and point the HTTP client used by the code under test at it.
Does garethp/http-playback support Laravel 10, 11, 12 and PHP 8.2 or 8.3?
There are no published compatibility guarantees for modern Laravel or PHP versions. The last release was in May 2021, so the package predates PHP 8.2/8.3 and Laravel 10 through 12. Before piloting, check the composer.json PHP constraint, PHPUnit alignment and the supported HTTP client major version, and expect that a fork or a version-constraint patch may be required.
Which HTTP client does garethp/http-playback decorate?
The package is described as an HTTP client with built-in record and playback, and in practice it is most likely built around Guzzle given the PHP ecosystem and the author's other packages. It is a thin utility rather than a framework integration, so the client it decorates and the client major versions it supports are the first things to confirm in the source. If your stack pins a newer Guzzle major, assume a compatibility spike is needed.
How is garethp/http-playback different from Laravel's Http::fake() and Http::record()?
Laravel's first-party Http::fake() and Http::record() cover the same record-and-replay use case, with official documentation, active maintenance and community familiarity. This package is framework-agnostic and offers no Laravel-specific integration, so adopting it introduces a parallel testing utility with no muscle memory in a Laravel team. Choose it only if it provides a specific capability the first-party options lack.
Is garethp/http-playback safe to use in production?
No. It should be a test-only, require-dev dependency and never shipped as part of your production runtime. The upside of that placement is that the blast radius of failure is confined to CI reliability and local development rather than production correctness. Wire it into test bootstrapping, not into application service providers.
What is the on-disk recording format and should I commit the fixtures?
The storage format is not documented in the package overview, so read the source to see how responses are serialized before you plan around it. The key questions are whether the format is stable across versions and whether it is readable and diffable in code review. Committing fixtures is the usual approach, but only once you know how noisy or volatile the recorded payloads are.
Does replay fail closed when an unexpected request is made?
This is a critical behaviour to verify and is not stated in the overview. A fail-closed design turns an unrecorded request into a test failure, while a fail-open design silently makes a real network call and hides the problem. Test it explicitly with an intentionally unmatched request before trusting the package in your suite.
Is garethp/http-playback still maintained?
It has very little external validation: a handful of stars, zero dependents, a single maintainer and a last release in May 2021. Treat it as effectively unmaintained and budget for reading and possibly forking the code yourself. The mitigating factor is that it is a small MIT-licensed test utility, so the code surface you would need to own is limited.
How do I migrate off garethp/http-playback to Http::fake() or a VCR library later?
Because recordings are just stored fixtures, the exit path is mostly a format-translation exercise rather than an architectural rewrite. Map the recorded responses into Laravel's Http::fake() payloads or a maintained VCR-style library's cassette format. That low lock-in is the strongest argument for a short, time-boxed evaluation instead of an outright rejection.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager