A MODX 3 Extra for importing and exporting elements and resources.
ModxTransfer provides an easy-to-use interface for exporting and importing MODX elements (Categories, Templates, Chunks, TVs, Snippets, Plugins) and Resources with their Template Variable values. Perfect for:
- Site migrations - Move content between MODX installations
- Backups - Export elements and resources to JSON files
- Starter kits - Package reusable templates and components
- Content staging - Move content from development to production
- Export all element types: Categories, Templates, Chunks, TVs, Snippets, Plugins
- Export resources with full hierarchy preservation
- Filter by category or template
- Include/exclude Template Variable values
- Include/exclude unpublished resources
- Automatic JSON file generation with download links
- Preview mode - see what will be created before executing
- Execute mode - create elements and resources
- Update existing elements option
- Automatic category and template assignment
- TV values imported including MIGX JSON data
- Resources imported as unpublished for review
- MODX Revolution 3.0+
- PHP 7.4+
- Download or clone this repository
- Copy
core/components/modxtransfer/to your MODXcore/components/directory - Copy
assets/components/modxtransfer/to your MODXassets/components/directory - Create a Namespace in MODX:
- Name:
modxtransfer - Core Path:
{core_path}components/modxtransfer/ - Assets Path:
{assets_path}components/modxtransfer/
- Name:
- Create System Settings:
- Key:
modxtransfer.core_pathValue:{core_path}components/modxtransfer/ - Key:
modxtransfer.assets_urlValue:{assets_url}components/modxtransfer/
- Key:
- Create a Menu item:
- Lexicon Key:
ModxTransfer - Action:
index - Namespace:
modxtransfer
- Lexicon Key:
Install via MODX Package Manager.
- Go to Extras → ModxTransfer
- Use the Export tab to export elements or resources
- Use the Import tab to import from JSON files
- Select which element types to export (Categories, Templates, Chunks, TVs, Snippets, Plugins)
- Optionally filter by Category
- Enter a filename
- Click Export Elements
- Download the generated JSON file
- Enter Parent IDs (comma-separated) or leave empty for all
- Set depth level
- Optionally filter by template names
- Choose whether to include TVs and unpublished resources
- Enter a filename
- Click Export Resources
- Enter the file path (relative to MODX root, e.g.,
assets/exports/my-elements.json) - Click Preview Elements to see what will be created
- Check "Update Existing" if you want to update elements that already exist
- Click Import Elements to execute
- Enter the file path
- Enter the Parent ID where resources should be imported
- Click Preview Resources to review
- Click Import Resources to execute
Note: Resources are imported as unpublished so you can review them before publishing.
You can also use ModxTransfer programmatically:
// Export elements to file
[[!ModxTransfer?
&action=`export`
&type=`elements`
&output=`file`
&file=`my-elements.json`
]]
// Export resources
[[!ModxTransfer?
&action=`export`
&type=`resources`
&parents=`5,10`
&output=`file`
&file=`my-resources.json`
]]
// Import elements (preview)
[[!ModxTransfer?
&action=`import`
&type=`elements`
&file=`assets/exports/my-elements.json`
&mode=`preview`
]]
// Import elements (execute)
[[!ModxTransfer?
&action=`import`
&type=`elements`
&file=`assets/exports/my-elements.json`
&mode=`execute`
]]
// Import resources
[[!ModxTransfer?
&action=`import`
&type=`resources`
&file=`assets/exports/my-resources.json`
&parentId=`5`
&mode=`execute`
]]{
"meta": {
"project": "My Project",
"description": "MODX Elements Export",
"created": "2025-12-16T12:00:00Z",
"exported_types": ["categories", "templates", "chunks", "tvs", "snippets", "plugins"],
"category_filter": ""
},
"categories": [
{"name": "My Category", "parent": ""}
],
"templates": [
{"name": "tpl.MyTemplate", "description": "", "category": "My Category", "content": "..."}
],
"chunks": [
{"name": "myChunk", "description": "", "category": "My Category", "content": "..."}
],
"tvs": [
{
"name": "myTV",
"caption": "My TV",
"description": "",
"type": "text",
"category": "My Category",
"templates": ["tpl.MyTemplate"],
"default": "",
"elements": "",
"display": "default"
}
],
"snippets": [
{"name": "mySnippet", "description": "", "category": "My Category", "content": "<?php return 'Hello';"}
],
"plugins": [
{"name": "myPlugin", "description": "", "category": "My Category", "content": "<?php ...", "events": ["OnLoadWebDocument"]}
]
}{
"meta": {
"project": "My Project",
"description": "MODX Resources Export",
"created": "2025-12-16T12:00:00Z",
"count": 5
},
"resources": [
{
"original_id": 1,
"pagetitle": "My Page",
"longtitle": "My Long Title",
"alias": "my-page",
"description": "Meta description",
"introtext": "Summary text",
"menutitle": "Menu Title",
"content": "<p>Page content...</p>",
"template": "BaseTemplate",
"parent": 0,
"published": 1,
"hidemenu": 0,
"menuindex": 0,
"searchable": 1,
"cacheable": 1,
"richtext": 1,
"isfolder": 0,
"tvs": {
"myTV": "TV value",
"myMIGX": [{"field": "value"}]
}
}
]
}| Parameter | Values | Default | Description |
|---|---|---|---|
&action |
export, import |
required | Operation to perform |
&type |
elements, resources |
required | What to import/export |
&mode |
preview, execute |
preview |
Preview or execute (import only) |
&output |
display, file, download |
display |
Output method (export only) |
&file |
string | Filename or path |
| Parameter | Default | Description |
|---|---|---|
&elementTypes |
all | Comma-separated: categories,templates,chunks,tvs,snippets,plugins |
&category |
Filter by category name |
| Parameter | Default | Description |
|---|---|---|
&parents |
Comma-separated parent IDs | |
&depth |
10 |
Depth to traverse |
&templates |
Filter by template names | |
&includeTVs |
1 |
Include TV values |
&includeContent |
1 |
Include content field |
&includeUnpublished |
0 |
Include unpublished resources |
| Parameter | Default | Description |
|---|---|---|
&file |
required | Path to JSON file |
&parentId |
0 |
Parent ID for resources |
&update |
0 |
Update existing elements |
&defaultTemplate |
Default template for resources |
core/components/modxtransfer/
├── controllers/
│ └── index.class.php
├── docs/
│ ├── changelog.txt
│ ├── license.txt
│ └── readme.txt
├── elements/
│ └── snippets/
│ └── modxtransfer.snippet.php
├── lexicon/
│ └── en/
│ ├── default.inc.php
│ └── properties.inc.php
├── model/
│ └── modxtransfer/
│ ├── modxtransfer.class.php
│ ├── elements/
│ │ └── modxtransferelements.class.php
│ └── resources/
│ └── modxtransferresources.class.php
├── processors/
│ └── mgr/
│ ├── export/
│ │ ├── elements.class.php
│ │ └── resources.class.php
│ └── import/
│ ├── elements.class.php
│ └── resources.class.php
└── templates/
└── mgr/
└── home.tpl
assets/components/modxtransfer/
├── connector.php
├── css/
│ └── mgr/
│ └── modxtransfer.css
└── js/
└── mgr/
├── modxtransfer.js
├── sections/
│ └── home.js
└── widgets/
├── export.panel.js
├── home.panel.js
└── import.panel.js
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
Built with ❤️ for the MODX Community
See CHANGELOG.md for version history.