Download the PHP package spodnet/laravel-http-client-replay without Composer

On this page you can find all versions of the php package spodnet/laravel-http-client-replay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-http-client-replay

📼 Laravel HTTP Client Replay

Zero-hack HTTP Record & Replay ("VCR") for modern Laravel applications.

Packagist PHP from Packagist Laravel 12 and 13 GitHub Workflow Status (main) Total Downloads


The Problem

When integrating third-party APIs (such as Strava, Stripe, GitHub, or OpenAI), local development and automated testing present major pain points:

The Solution

laravel-http-client-replay records real outbound HTTP requests made via Laravel's native HTTP Client (Http::*), sanitizes sensitive secrets (bearer tokens, API keys, passwords), and saves them into clean JSON cassettes. Subsequent requests replay deterministically using Laravel's native Http::fake() without touching the internet.


Installation

Install the package via Composer:

Publish the configuration file:

(Optional) If you plan to use the database cassette storage driver, publish and run the migration:


Quickstart

1. Configure the Mode

Set the mode in your .env or phpunit.xml:

2. Make Normal HTTP Requests

Continue using Laravel's standard Http facade. Everything works automatically:


Operating Modes

Configure the active mode in config/http-client-replay.php or via the HTTP_CLIENT_REPLAY_MODE environment variable:

Mode Live Network Cassette Behavior Use Case
auto (default) Only when missing Replays if cassette exists; records from live if missing Daily local development & integration testing
replay Never Replays cassette; throws CassetteNotFoundException if missing Strict CI environments & offline testing
record Always Executes live call, redacts secrets, and overwrites cassette Refreshing cassettes with updated API responses
off Always Passthrough; completely disables recording and intercepting Production or unmocked live workflows

You can switch modes programmatically at runtime:


Testing Ergonomics

Using Named Cassettes

By default, cassettes are saved with a deterministic identifier derived from the request URL and payload. In tests, you can assign human-friendly cassette names:

You can also pass a closure to useCassette() to scope the cassette to that specific block:

Test Trait (InteractsWithHttpClientReplay)

Include the trait in your Pest or PHPUnit tests for convenience:


Sensitive Data Redaction

Cassettes should be safe to commit to version control. laravel-http-client-replay automatically redacts sensitive data before writing cassettes to storage.

Configure what to redact in config/http-client-replay.php:


Auto-Expiring Cassettes (TTL)

Cassettes can be configured to automatically expire after a set duration. When an expired cassette is accessed:

TTL values mirror Laravel Cache and accept integer seconds, \DateTimeInterface (e.g. now()->addHours(2)), \DateInterval, or \Carbon\CarbonInterval.

1. Using remember() (Mirroring Cache::remember())

2. Request-Level Expiration via Laravel HTTP Client Options

3. Fluent Runtime Modifiers & Touching Cassettes


Domain & URL Scoping

To avoid intercepting unrelated outbound requests (like internal microservices, AWS S3, or third-party webhooks), scope which URLs to handle:

In Configuration (config/http-client-replay.php)

Scopes can be defined as simple strings or keyed with scope options like ttl:

At Runtime


Pluggable Storage Drivers

laravel-http-client-replay supports multiple storage drivers configured via HTTP_CLIENT_REPLAY_DRIVER:

1. file Driver (Default)

Stores cassettes as human-readable .json files on local disk:

2. disk Driver

Stores cassettes on any configured Laravel Filesystem disk (e.g. s3, local):

3. database Driver

Persists cassettes in a database table:


Artisan Commands

List Recorded Cassettes

View all recorded cassettes along with their size, age, HTTP status, and request signature:

Example output:

Clear Recorded Cassettes

Delete all cassettes or filter by domain:


Testing & Quality

Run full validation (Static analysis, Pint linting, 100% type coverage, and parallel Pest unit tests):

Or individual commands:


Changelog

Please see CHANGELOG.md for more information on what has changed recently.

Contributing

Please review CONTRIBUTING.md to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Laravel HTTP Client Replay is open-source software licensed under the MIT license.


All versions of laravel-http-client-replay with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/http Version ^12.0||^13.0
illuminate/support Version ^12.0||^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spodnet/laravel-http-client-replay contains the following files

Loading the files please wait ...