evgenijfaustov/debug-snapshot-bundle
Symfony bundle for exporting and importing Doctrine ORM aggregates as a debug snapshot ZIP.
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],
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 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.
php bin/console debug:snapshot:export order <ORDER_ID> --out=var/snapshots --anonymize=1
php bin/console debug:snapshot:import var/snapshots/<FILE>.zip
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 "[email protected]"
--anonymize=1 is passed.How can I help you explore Laravel packages today?