PHPackages                             justintime50/vcr-accessories - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. justintime50/vcr-accessories

ActiveLibrary

justintime50/vcr-accessories
============================

Various accessories for your PHP VCR

v0.4.0(4mo ago)01.8kMITPHPPHP ^8.1CI passing

Since Mar 29Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Justintime50/vcr-accessories-php)[ Packagist](https://packagist.org/packages/justintime50/vcr-accessories)[ GitHub Sponsors](https://github.com/Justintime50)[ RSS](/packages/justintime50-vcr-accessories/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (6)Used By (0)

VCR Accessories
===============

[](#vcr-accessories)

[![Build Status](https://github.com/Justintime50/vcr-accessories-php/workflows/build/badge.svg)](https://github.com/Justintime50/vcr-accessories-php/actions)[![Coverage Status](https://camo.githubusercontent.com/bce38792621452032d6437830b90152e57a50b57a6e2891eab1e529a1ea52ca8/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6a757374696e74696d6535302f7663722d6163636573736f726965732d706870)](https://app.codecov.io/github/Justintime50/vcr-accessories-php)[![Version](https://camo.githubusercontent.com/aa3d4ae17c6895ab002b0e84859d0327caffac25029cfa6ded982b74504696b1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6a757374696e74696d6535302f7663722d6163636573736f726965732d706870)](https://github.com/justintime50/vcr-accessories-php/releases)[![Licence](https://camo.githubusercontent.com/bef6c03635bb971b3095045fd8f880afac6d73d23438f9ccec22bb9f88af67bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a757374696e74696d6535302f7663722d6163636573736f726965732d706870)](LICENSE)

Various tools and accessories for your [PHP VCR](https://github.com/php-vcr/php-vcr).

When working with VCR solutions, I'm often finding I need a few extra "accessories" to get them working the way I want. This package includes the following:

- Cassette scrubbing (eg: sensitive data)
- Expire and warn or error on stale cassettes
- Setup a cassette directory
- Setup and teardown VCR tests

Install
-------

[](#install)

```
# Install in your project
composer require --dev justintime50/vcr-accessories

# Install locally
composer install
```

Usage
-----

[](#usage)

### bootstrap.php

[](#bootstrapphp)

```
use allejo\VCR\VCRCleaner;
use VCR\VCR;
use VCRAccessories\CassetteScrubber;
use VCRAccessories\CassetteSetup;

const CASSETTE_DIR = 'tests/cassettes';
CassetteSetup::setupCassetteDirectory(CASSETTE_DIR);

VCR::configure()->setCassettePath(CASSETTE_DIR)
    ->setStorage('yaml')
    ->setMode('once')
    ->setWhiteList(['vendor/guzzle']);

const REDACTED_STRING = '';

// SCRUBBERS must be a multidimensional array where the first index of each nested array is the key
// you want to scrub and the second index is what you want it to be replaced with before persisting to disk
define('SCRUBBERS', [
    ['origin', REDACTED_STRING],
]);

VCRCleaner::enable([
    'response' => [
        'bodyScrubbers' => [
            function ($responseBody) {
                $responseBodyJson = json_decode($responseBody, true);
                $responseBodyEncoded = CassetteScrubber::scrubCassette(SCRUBBERS, $responseBodyJson);

                // Re-encode the data so we can properly store it in the cassette
                return json_encode($responseBodyEncoded);
            }
        ],
    ],
]);
```

### Test File

[](#test-file)

```
use VCRAccessories\CassetteSetup;

public static function setUpBeforeClass(): void
{
    CassetteSetup::setupVcrTests();
}

public static function tearDownAfterClass(): void
{
    CassetteSetup::teardownVcrTests();
}

public function myTest()
{
    CassetteSetup::setupCassette(
        cassetteName: 'nameOfCassette.yaml',
        expirationDays: 180,
        expirationError: true
    );

    // Your test here
}
```

Development
-----------

[](#development)

```
# Install dependencies
composer install

# Lint
composer lint
composer fix
composer phpstan

# Test
composer test
composer coverage
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance77

Regular maintenance activity

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~252 days

Total

5

Last Release

133d ago

PHP version history (2 changes)v0.1.0PHP ^8.0

v0.4.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39606064?v=4)[Justin Hammond](/maintainers/justintime50)[@Justintime50](https://github.com/Justintime50)

---

Top Contributors

[![Justintime50](https://avatars.githubusercontent.com/u/39606064?v=4)](https://github.com/Justintime50 "Justintime50 (30 commits)")

---

Tags

phpphp-vcrvcr

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/justintime50-vcr-accessories/health.svg)

```
[![Health](https://phpackages.com/badges/justintime50-vcr-accessories/health.svg)](https://phpackages.com/packages/justintime50-vcr-accessories)
```

###  Alternatives

[php-vcr/phpunit-testlistener-vcr

Integrates PHPUnit with PHP-VCR.

63863.2k59](/packages/php-vcr-phpunit-testlistener-vcr)[allejo/php-vcr-sanitizer

Bring privacy to php-vcr by excluding API keys, passwords, and credentials from your recordings

14580.6k5](/packages/allejo-php-vcr-sanitizer)[php-vcr/vcr-bundle

Integrates php-vcr into Symfony and its web profiler.

1326.7k](/packages/php-vcr-vcr-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
