PHPackages                             dennispansegrau/pimcore-content-migration-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. dennispansegrau/pimcore-content-migration-bundle

ActivePimcore-bundle[Database &amp; ORM](/categories/database)

dennispansegrau/pimcore-content-migration-bundle
================================================

A Pimcore bundle that generates Doctrine-like migrations for Documents, Assets, and Data Objects — allowing developers to export Pimcore content structures as executable migration scripts to fully rebuild environments from scratch.

1.0.0(2mo ago)2288proprietaryPHPPHP ^8.2CI passing

Since Jan 20Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/dennispansegrau/pimcore-content-migration-bundle)[ Packagist](https://packagist.org/packages/dennispansegrau/pimcore-content-migration-bundle)[ RSS](/packages/dennispansegrau-pimcore-content-migration-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (16)Used By (0)

Compatibility: Pimcore 11 and above.

Pimcore Content Migrations Bundle
=================================

[](#pimcore-content-migrations-bundle)

The **Pimcore Content Migrations Bundle** introduces a migration system — similar to Doctrine Migrations — for **Documents**, **Assets**, and **Data Objects** in Pimcore.
It allows developers to export Pimcore content structures as **executable PHP migration scripts** and **rebuild entire environments from scratch**, enabling consistent and reproducible deployments across development, staging, and production systems.
The generated migrations create only dummy dependencies — documents, assets, and data objects are included with their content, but without their dependencies or child elements.

---

📚 Table of Contents
-------------------

[](#-table-of-contents)

- [✨ Features](#-features)
- [⚙️ Installation](#-installation)
- [🧩 CLI Command](#-cli-command)
- [💻 Example](#-example)
- [🧰 Configuration](#-configuration)
- [🧩 Custom DataType handlers](#-custom-datatype-handlers)
- [🎨 Custom Twig templates](#-custom-twig-templates)
- [🧠 Notes](#-notes)
- [🧾 License](#-license)

---

✨ Features
----------

[](#-features)

- Generates migration scripts for Pimcore Documents, Assets, and Data Objects
- Rebuilds complete content structures on any environment
- Integrates with version control and deployment workflows

---

⚙️ Installation
---------------

[](#️-installation)

Install the bundle via Composer:

```
composer require dennispansegrau/pimcore-content-migration-bundle
```

Add the bundle to your config/bundles.php:

```
return [
    // ...
    \PimcoreContentMigration\PimcoreContentMigrationBundle::class => ['all' => true],
];
```

---

🧰 Configuration
---------------

[](#-configuration)

If you do not use doctrine migrations in your project yet, please add following to your config/config.yaml:

```
doctrine_migrations:
    migrations_paths:
        'App\Migrations\Content': '%kernel.project_dir%/migrations/content'

```

This defines where generated content migration files are stored.

You can also set a default namespace to avoid passing it every time:

```
pimcore_content_migration:
    default_namespace: 'App\Migrations\Content'

```

When set, `content:migration:create` uses this namespace if none is provided.

---

🧩 CLI Command
-------------

[](#-cli-command)

```
bin/console content:migration:create [TYPE] [ID] [--namespace=...] [--with-children] [--inline-wysiwyg]

```

NameDescription**TYPE**The Pimcore element type (`document`, `asset`, or `object`)**ID**The ID of the Pimcore element to exportOptionDescription`--namespace`The namespace for the generated migration class (falls back to `pimcore_content_migration.default_namespace` if set)`--with-children`Include all child elements (e.g., sub-documents or child objects) in the migration file`--inline-wysiwyg`Inline WYSIWYG field content directly into the migration instead of saving it in a separate HTML file💻 Example
---------

[](#-example)

```
bin/console content:migration:create document 1 --namespace=App\\Migrations\\Content
```

This command creates a migration for the document with ID 1 and stores it in the namespace App\\Migrations\\Content.

---

🧩 Custom DataType handlers
--------------------------

[](#-custom-datatype-handlers)

If you use custom DataTypes (or hit "Unsupported object of class" errors), you can register your own stringifier handler to control how values are serialized in migrations.

Example handler:

```
