Skip to content
PHP Ecosystem
Explore

SnapshotStore

API reference › Debug › storage › SnapshotStore

final classyii\debug\storage\SnapshotStore
Sourcesrc/storage/SnapshotStore.php

Yii2 compatibility facade for the framework-neutral snapshot store.

MethodDescriptionDefined by
__construct()Creates a Yii2 facade for the framework-neutral store.SnapshotStore
forModule() staticCreates a store bound to the module’s data path and permission settings.SnapshotStore
loadManifest()Returns manifest entries ordered from newest to oldest.SnapshotStore
loadManifestResult()Returns manifest entries together with an optional core storage diagnostic.SnapshotStore
readSnapshot()Returns a stored snapshot or null when unavailable.SnapshotStore
writeSnapshot()Writes a snapshot and manifest update through one core storage transaction.SnapshotStore
writeSnapshotResult()Writes a snapshot and returns the committed manifest from the same storage transaction, without a second read.SnapshotStore
public function __construct(string $path, int $dirMode, int|null $fileMode)

Creates a Yii2 facade for the framework-neutral store.

Parameters

ParameterTypeDescription
$pathstringStorage directory path.
$dirModeintDirectory permissions used when creating the storage path.
$fileModeint|nullFile permissions or null to preserve the system default.
public static function forModule(yii\debug\Module $module): self

Creates a store bound to the module’s data path and permission settings.

Parameters

ParameterTypeDescription
$moduleyii\debug\ModuleDebug module whose dataPath, dirMode, and fileMode configure the store.

Returns

self: Store bound to the module settings.

public function loadManifest(): array<string, PHPForge\Debug\Storage\RequestSummary>

Returns manifest entries ordered from newest to oldest.

Returns

array<string, PHPForge\Debug\Storage\RequestSummary>: Newest entries first.

public function loadManifestResult(): PHPForge\Debug\Storage\ManifestReadResult

Returns manifest entries together with an optional core storage diagnostic.

Returns

PHPForge\Debug\Storage\ManifestReadResult: Manifest entries plus the storage diagnostic, when one was raised.

public function readSnapshot(string $tag): PHPForge\Debug\Storage\DebugSnapshot|null

Returns a stored snapshot or null when unavailable.

Parameters

ParameterTypeDescription
$tagstringSnapshot tag.

Returns

PHPForge\Debug\Storage\DebugSnapshot|null: Hydrated snapshot or null when unavailable.

public function writeSnapshot(PHPForge\Debug\Storage\DebugSnapshot $snapshot, int $historySize): list<PHPForge\Debug\Storage\RequestSummary>

Writes a snapshot and manifest update through one core storage transaction.

Parameters

ParameterTypeDescription
$snapshotPHPForge\Debug\Storage\DebugSnapshotSnapshot to persist.
$historySizeintMaximum number of retained entries.

Returns

list<PHPForge\Debug\Storage\RequestSummary>: Entries evicted from the manifest.

public function writeSnapshotResult(PHPForge\Debug\Storage\DebugSnapshot $snapshot, int $historySize): yii\debug\storage\SnapshotWriteResult

Writes a snapshot and returns the committed manifest from the same storage transaction, without a second read.

Parameters

ParameterTypeDescription
$snapshotPHPForge\Debug\Storage\DebugSnapshotSnapshot to persist.
$historySizeintMaximum number of retained entries.

Returns

SnapshotWriteResult: Committed entries and evictions.