evgenijfaustov / debug-snapshot-bundle
Debug Snapshot Feature
Package info
github.com/eugenfaust/debug-snapshot-bundle
Type:symfony-bundle
pkg:composer/evgenijfaustov/debug-snapshot-bundle
v0.2.1
2026-02-03 06:10 UTC
Requires
- php: ^8.3
- ext-zip: *
- doctrine/orm: ^2.17 || ^3.0
- symfony/console: ^7.1
- symfony/filesystem: ^7.1
- symfony/framework-bundle: ^7.1
- symfony/options-resolver: ^7.1
- symfony/security-bundle: ^7.1
- symfony/serializer: ^7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: *
- phpstan/phpstan: *
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0 || ^11.0
- rector/rector: *
- symfony/phpunit-bridge: ^7.1
README
Symfony bundle for exporting and importing Doctrine ORM aggregates as a debug snapshot ZIP.
Requirements
- PHP 8.2+
- Symfony 7.1+
- Doctrine ORM 2.17+ or 3.x
Installation
composer require evgenijfaustov/debug-snapshot-bundle
If the bundle was not registered automatically, add it to config/bundles.php:
Evgenijfaustov\DebugSnapshotBundle\DebugSnapshotBundle::class => ['all' => true],
Configuration
debug_snapshot: enabled: true http: enabled: false role: ROLE_DEBUG_SNAPSHOT profiles: order: root_class: App\Entity\Order max_depth: 3 max_nodes: 5000 include: App\Entity\Order: [customer, items] App\Entity\Customer: [] App\Entity\OrderItem: [] pii_fields: App\Entity\Customer: [email, phone]
include rules
include is an allowlist of Doctrine associations to traverse per entity class.
If a class is present in include with [], no relations are traversed for that class.
Relations not listed in include are not exported.
Export
php bin/console debug:snapshot:export order <ORDER_ID> --out=var/snapshots --anonymize=1
Import
php bin/console debug:snapshot:import var/snapshots/<FILE>.zip
HTTP endpoints
Enable routes and role-based access in your app:
# config/routes/debug_snapshot.yaml debug_snapshot: resource: '@DebugSnapshotBundle/Resources/config/routes.php'
# config/packages/debug_snapshot.yaml debug_snapshot: http: enabled: true role: ROLE_DEBUG_SNAPSHOT
Export (returns zip):
curl -X POST "https://example.test/_debug/snapshot/export/order/<ORDER_ID>?anonymize=1" -o snapshot.zip
Import:
curl -X POST "https://example.test/_debug/snapshot/import?anonymize=1" -F "snapshot=@snapshot.zip"
Snapshot format (v1)
- meta.json contains format, createdAt, profile, root, checksum
- snapshot.json contains format, root, entities with fields and relations
Notes
- Composite identifiers are not supported.
- Only scalar fields are exported; relations are stored as references.
- PII masking is applied when
--anonymize=1is passed.