PHPackages                             wp-php-toolkit/data-liberation - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wp-php-toolkit/data-liberation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wp-php-toolkit/data-liberation
==============================

Data Liberation component for WordPress.

v0.8.1(1mo ago)0119.8k↑98013.3%6GPL-2.0-or-laterPHPPHP &gt;=7.2

Since Jun 2Pushed 1mo agoCompare

[ Source](https://github.com/wp-php-toolkit/data-liberation)[ Packagist](https://packagist.org/packages/wp-php-toolkit/data-liberation)[ Docs](https://wordpress.github.io/php-toolkit/reference/dataliberation.html)[ RSS](/packages/wp-php-toolkit-data-liberation/feed)WikiDiscussions trunk Synced yesterday

READMEChangelogDependencies (14)Versions (49)Used By (6)

   slug dataliberation   title DataLiberation   install wp-php-toolkit/data-liberation   see\_also    ../learn/03-importing-content.html | Tutorial — Markdown to WXR | The chapter that walks through importing a folder of Markdown files into WordPress via the toolkit.

 markdown | Markdown | Use Markdown as a source or destination format.

 blockparser | BlockParser | Analyze serialized blocks inside post content.

 httpclient | HttpClient | Download media and remote source data while importing.

    Streaming WordPress import/export. WXR, SQL, block markup — process entities one at a time instead of building whole-dataset object graphs.

Why this exists
---------------

[](#why-this-exists)

WordPress content should be portable, but real migrations cross several formats. A site export might arrive as WXR, a Markdown folder, or entities from another CMS. URLs can hide in block attributes, HTML, CSS, feeds, GUIDs, and post meta. Importers must also resume after a failed media download or upload.

The DataLiberation component streams WordPress-shaped data through readers, transformers, and writers. It models posts, terms, comments, attachments, and metadata as `ImportEntity` objects, then lets a pipeline rewrite each entity without loading the full export into memory.

The API reflects specific migration bugs: relative URLs in known block attributes, URLs inside inline CSS, self-closing block comments that must keep their shape, and origin-only URLs whose trailing slash style should not change during a rewrite.

Reach for it when the job combines formats: build WXR from another CMS, rewrite a staging export for production, frontload remote assets, or compose Markdown, XML, HTML, CSS, and URL rewriting into one pipeline.

Write a WXR file in five lines
------------------------------

[](#write-a-wxr-file-in-five-lines)

Stream a single post into a WXR document via `WXRWriter`. The writer emits each entity to the output stream and only keeps the small amount of state needed for the current document.

```
