phpcr/phpcr-migrations-bundle
A Symfony bundle that adds PHPCR migration support to your application, letting you version and apply content repository changes through configurable migration versions and console commands so database and repository updates stay consistent across environments.
composer require phpcr/phpcr-migrations-bundle. On Symfony Flex the bundle is usually auto-registered; otherwise add it to config/bundles.php. You need a working Doctrine PHPCR-ODM / Jackalope stack already configured (doctrine_phpcr), because the bundle just wires the migration manager to your existing PHPCR session.config/packages/phpcr_migrations.yaml (the key is typically migrations_path, plus an optional version/collection name). If your project uses a custom autoloader, make sure migration classes live in a PSR-4 namespace Composer knows about.vendor/phpcr/phpcr-migrations/src/ — the MigrationInterface (or AbstractMigration) and the MigrationManager/Factory define the whole contract: up(), an optional down(), and a version string. Then check the bundle's Console/ directory for the exact command names shipped in your version.bin/console list phpcr to confirm the commands, then phpcr:migrations:status (or versions) against your repository. Generate your first migration for a small, real content fix — rename a property, clean orphaned references, move a subtree — implement up(), run phpcr:migrations:migrate, and re-run status to confirm the version was recorded.MigrationInterface (often extending AbstractMigration) with a version/description and up()/down() receiving the migration context. Keep up() idempotent where cheap to do so: re-fetch the node, guard with hasProperty(), and skip if already applied.nt:unstructured to a mapped document, rename fields to match updated ODM mappings, move documents between parents, or delete stale nodes. Use the PHPCR session directly for structural ops and the ODM DocumentManager when you need mapped documents.phpcr:migrations:migrate --no-interaction as a post-deploy step, executed exactly once per release (a single deploy job, not every web pod). Gate it behind a successful cache warmup and a reachable repository.save() in chunks, and clear() the ODM unit of work between batches rather than one giant save./jcr:system or a configurable path). Wiping or restoring that node makes migrations re-run or be silently skipped — back it up alongside the content, and never "fix" it by hand without knowing the version strings.down() may exist without a rollback command to invoke it, or the manager may only support forward execution. Treat down() as documentation/emergency tooling, and write forward-only migrations you can trust.save() on changed nodes. Large changesets can be slow or hit Jackalope limits — commit incrementally.10 never sorts before 9.clear()/refresh() (or run structural reads via the session) before asserting on the result.migrations_path namespace matches the use statements in generated files.-vvv on the migrate command, and inspect the ledger node directly (via your PHPCR browser or a quick phpcr:node:dump) to see what the bundle believes is applied. Compare that to the files on disk when status looks wrong.Resources/config for the actual service IDs before wiring anything.How can I help you explore Laravel packages today?