PHPackages                             spatie/pest-plugin-snapshots - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. spatie/pest-plugin-snapshots

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spatie/pest-plugin-snapshots
============================

A package for snapshot testing in Pest

2.3.0(3mo ago)381.7M—6.3%11[1 PRs](https://github.com/spatie/pest-plugin-snapshots/pulls)20MITPHPPHP ^8.1CI failing

Since Jun 1Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/spatie/pest-plugin-snapshots)[ Packagist](https://packagist.org/packages/spatie/pest-plugin-snapshots)[ Docs](https://github.com/spatie/pest-plugin-snapshots)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-pest-plugin-snapshots/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (15)Used By (20)

Snapshot Testing for Pest
=========================

[](#snapshot-testing-for-pest)

[![Latest Version on Packagist](https://camo.githubusercontent.com/acf36ff260c90aafb83ecaf17d185d777ee245956b8261432e1757eff9140ce0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f706573742d706c7567696e2d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/pest-plugin-snapshots)[![run-tests](https://github.com/spatie/pest-plugin-snapshots/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/pest-plugin-snapshots/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/41b351f9029887394b0af3899991891389d7ffed6e822e1a53bf7fe036585386/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f706573742d706c7567696e2d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/pest-plugin-snapshots)

This package adds snapshot testing capabilities to **[Pest](https://pestphp.com)**. It wraps our [phpunit-snapshot-assertions](https://github.com/spatie/phpunit-snapshot-assertions) package making snapshot assertions available in Pest tests.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/9cd1ea47cd641d27440369a3858cb596c04cfd8243a729fcbe67683bbaa54797/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f706573742d706c7567696e2d736e617073686f74732e6a70673f743d31)](https://spatie.be/github-ad-click/pest-plugin-snapshots)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require spatie/pest-plugin-snapshots --dev
```

Usage
-----

[](#usage)

```
use function Spatie\Snapshots\{assertMatchesSnapshot, assertMatchesJsonSnapshot};

it('can be cast to string', function () {
    $order = new Order(1);

    assertMatchesSnapshot($order->toString());
});

it('can be cast to json', function () {
    $order = new Order(1);

    assertMatchesJsonSnapshot($order->toJson());
});
```

You can also use an expectation:

```
it('can be cast to string', function () {
    $order = new Order(1);

    expect($order->toString())->toMatchSnapshot();
});
```

For the full list of assertions, please refer to underlying package: [phpunit-snapshot-assertions](https://github.com/spatie/phpunit-snapshot-assertions).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Nuno Maduro](https://github.com/nunomaduro)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance81

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~173 days

Recently: every ~261 days

Total

13

Last Release

98d ago

Major Versions

0.3.1 → 1.0.02021-01-03

1.1.0 → 2.0.02023-02-09

PHP version history (3 changes)0.1.0PHP ^7.4

0.3.0PHP ^7.4 || ^8.0

2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (33 commits)")[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (21 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (8 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (4 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (2 commits)")[![onlime](https://avatars.githubusercontent.com/u/2759561?v=4)](https://github.com/onlime "onlime (1 commits)")

---

Tags

phpsnapshotstestingpluginspatiepestsnapshots

### Embed Badge

![Health badge](/badges/spatie-pest-plugin-snapshots/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-pest-plugin-snapshots/health.svg)](https://phpackages.com/packages/spatie-pest-plugin-snapshots)
```

###  Alternatives

[spatie/pest-plugin-route-testing

Make sure all routes in your Laravel app are ok

13753.8k](/packages/spatie-pest-plugin-route-testing)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[spatie/pest-plugin-test-time

A Pest plugin to control the flow of time

491.5M94](/packages/spatie-pest-plugin-test-time)[jonpurvis/lawman

A PestPHP Plugin to help with architecture testing SaloonPHP integrations

4027.7k8](/packages/jonpurvis-lawman)

PHPackages © 2026

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