PHPackages                             copperforest/snapshot - 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. copperforest/snapshot

ActiveComposer-plugin

copperforest/snapshot
=====================

A composer plugin that let you choose differents code snapshots for differents users

00PHP

Since Dec 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/CopperForest/snapshot)[ Packagist](https://packagist.org/packages/copperforest/snapshot)[ RSS](/packages/copperforest-snapshot/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

snapshot
========

[](#snapshot)

This composer plugin let you choose differents code snapshots for differents users.

implements the SessionInterface
-------------------------------

[](#implements-the-sessioninterface)

The first step to use the snashots system is ensure that you **SessionHandler** class implements the interface **copperforest\\snapshot\\authentication\\SessionHandlerInterface**. For this you must create the next five methods:

- **getUserId()**: must return the ID of the current user.
- **setPreviousUserId( $id )**: must store the parameter $id in session, for example:

```
$_SESSION[ 'PreviousUserId' ] = $id;
```

- **getPreviousUserId()**: return the value stored in the previous method, for example:

```
return $_SESSION[ 'PreviousUserId' ];
```

- **setPreviousSnapshot( $snapshot )**: must store the parameter $snapshot in session, for example:

```
$_SESSION[ 'PreviousSnapshot' ] = $snapshot;
```

- **getPreviousSnapshot()**: return the value stored in the previous method, for example:

```
return $_SESSION[ 'PreviousSnapshot' ];
```

new composer command
--------------------

[](#new-composer-command)

This plugin define a new composer comand: **create-snapshot**. You must run this command each time you update you code to create a new code snapshot.

```
php composer.phar create-snapshot
```

choose the snapshot
-------------------

[](#choose-the-snapshot)

You must edit the file **./snapshots/snapshot.json** and choose the :

```
{
    "snapshot":{
        "1": [ "default", "cli" ],
        "2":[ "122", "123" ]
    }
}
```

warning
-------

[](#warning)

The SessionHandler class (and all the classes used in its \_\_construct() method) allways loads from default snapshot because previously we don't know the user ID.

### That's all

[](#thats-all)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5556fb4d44fd0a3cc2ccf7da2eb8311f0e774cea99ee16e711598f7c994c8588?d=identicon)[copperforest](/maintainers/copperforest)

---

Top Contributors

[![AlejandroGama](https://avatars.githubusercontent.com/u/7498937?v=4)](https://github.com/AlejandroGama "AlejandroGama (11 commits)")[![krowork](https://avatars.githubusercontent.com/u/7427946?v=4)](https://github.com/krowork "krowork (3 commits)")

### Embed Badge

![Health badge](/badges/copperforest-snapshot/health.svg)

```
[![Health](https://phpackages.com/badges/copperforest-snapshot/health.svg)](https://phpackages.com/packages/copperforest-snapshot)
```

PHPackages © 2026

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