PHPackages                             andreo/eventsauce-snapshotting - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. andreo/eventsauce-snapshotting

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

andreo/eventsauce-snapshotting
==============================

Extended snapshot components for EventSauce.

05.5k2PHP

Since Jul 24Pushed 11mo agoCompare

[ Source](https://github.com/andreo-code/eventsauce-snapshotting)[ Packagist](https://packagist.org/packages/andreo/eventsauce-snapshotting)[ RSS](/packages/andreo-eventsauce-snapshotting/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (8)Used By (2)

eventsauce-snapshotting 3.0
---------------------------

[](#eventsauce-snapshotting-30)

Extended snapshot components for EventSauce

[About Snapshotting](https://eventsauce.io/docs/snapshotting/)

### Installation

[](#installation)

```
composer require andreo/eventsauce-snapshotting
```

#### Previous versions

[](#previous-versions)

- [2.0](https://github.com/eventsauce-symfony/eventsauce-snapshotting/tree/2.0.0)

### Requirements

[](#requirements)

- PHP &gt;=8.2
- Doctrine Dbal ^3.1

### Doctrine snapshot repository

[](#doctrine-snapshot-repository)

```
use Andreo\EventSauce\Snapshotting\Doctrine\DoctrineSnapshotRepository;

new DoctrineSnapshotRepository(
    connection: $connection, // Doctrine\DBAL\Connection
    tableName: $tableName,
    serializer: $serializer, // Andreo\EventSauce\Snapshotting\Serializer\SnapshotStateSerializer
    uuidEncoder: $uuidEncoder, // EventSauce\UuidEncoding\UuidEncoder
    tableSchema: $tableSchema // Andreo\EventSauce\Snapshotting\Repository\Table\SnapshotTableSchema
)
```

### Versioning

[](#versioning)

Repository

```
use Andreo\EventSauce\Snapshotting\Versioned\AggregateRootRepositoryWithVersionedSnapshotting;

new AggregateRootRepositoryWithVersionedSnapshotting(
    aggregateRootClassName: $aggregateRootClassName,
    messageRepository: $messageRepository
    regularRepository: $regularRepository, // EventSauce\EventSourcing\AggregateRootRepository
    snapshotVersionInflector: $snapshotVersionInflector, // Andreo\EventSauce\Snapshotting\Repository\Versioned\SnapshotVersionInflector
    snapshotVersionComparator: $snapshotVersionComparator // Andreo\EventSauce\Snapshotting\Repository\Versioned\SnapshotVersionComparator
);
```

Versioned Snapshot State

```
use Andreo\EventSauce\Snapshotting\Versioned\VersionedSnapshotState;

final class FooSnapshotStateV2 implements VersionedSnapshotState {

    public static function getSnapshotVersion(): int|string|Stringable
    {
        return 2;
    }
}
```

Example of aggregate

```
use Andreo\EventSauce\Snapshotting\Aggregate\VersionedSnapshottingBehaviour;
use EventSauce\EventSourcing\AggregateRootBehaviour;
use EventSauce\EventSourcing\AggregateRootId;
use EventSauce\EventSourcing\Snapshotting\AggregateRootWithSnapshotting;

final class FooAggregate implements AggregateRootWithSnapshotting
{
    use AggregateRootBehaviour;
    use VersionedSnapshottingBehaviour;

    // Create snapshot method must have type hint of VersionedSnapshotState implementation (with default SnapshotVersionInflector)
    protected function createSnapshotState(): FooSnapshotStateV2
    {
        return new FooSnapshotStateV2();
    }

    protected static function reconstituteFromSnapshotState(AggregateRootId $id, $state): AggregateRootWithSnapshotting
    {
        assert($state instanceof FooSnapshotStateV2);
    }
}
```

### Conditional Strategy

[](#conditional-strategy)

```
interface ConditionalSnapshotStrategy
{
    public function canStoreSnapshot(AggregateRootWithSnapshotting $aggregateRoot): bool;
}
```

#### Built-in strategies

[](#built-in-strategies)

Every n event

```
use Andreo\EventSauce\Snapshotting\Conditional\AggregateRootRepositoryWithConditionalSnapshot;use Andreo\EventSauce\Snapshotting\Conditional\EveryNEventConditionalSnapshotStrategy;

new AggregateRootRepositoryWithConditionalSnapshot(
    regularRepository: $regularRepository, // EventSauce\EventSourcing\Snapshotting\AggregateRootRepositoryWithSnapshotting
    conditionalSnapshotStrategy: new EveryNEventConditionalSnapshotStrategy(numberOfEvents: 200) # or your implementation
);
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

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

Recently: every ~12 days

Total

7

Last Release

1193d ago

Major Versions

1.0.0 → 2.0.02022-04-24

2.0.0 → 3.02023-02-05

PHP version history (2 changes)1.0.0PHP ^8.1

3.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![andreo-code](https://avatars.githubusercontent.com/u/18660333?v=4)](https://github.com/andreo-code "andreo-code (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/andreo-eventsauce-snapshotting/health.svg)

```
[![Health](https://phpackages.com/badges/andreo-eventsauce-snapshotting/health.svg)](https://phpackages.com/packages/andreo-eventsauce-snapshotting)
```

###  Alternatives

[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)[typo3/cms-redirects

TYPO3 CMS Redirects - Create manual redirects, list existing redirects and automatically createredirects on slug changes.

167.4M80](/packages/typo3-cms-redirects)[rias/statamic-redirect

29335.6k](/packages/rias-statamic-redirect)[terminal42/contao-node

Node bundle for Contao Open Source CMS

3177.0k6](/packages/terminal42-contao-node)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[eliashaeussler/typo3-form-consent

Extension for TYPO3 CMS that adds double opt-in functionality to EXT:form

1595.5k](/packages/eliashaeussler-typo3-form-consent)

PHPackages © 2026

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