This is a simple library that loading wpdump's output in php.
require_once "vendor/autoload.php";
use WPDumpSupport\WPDump;
// Initialize WPDump with the JSON directory and cache directory.
$wpDump = new WPDump(['jsonDir' => '/path/to/wp-json/save/dir', 'cacheDir' => '/path/to/cache/dir']);
// Load reference data (tags, categories, users, etc.) into memory for quick access.
// This is necessary to resolve references from posts or pages.
$wpDump->load();
// Stream posts one by one to avoid memory exhaustion with large datasets.
foreach ($wpDump->streamPosts() as $post) {
// Process each post object.
// Author and other references are resolved.
echo "Post Title: " . $post->title . "\n";
if ($post->author) {
echo "Author Name: " . $post->author->name . "\n";
}
}
For more detailed information on the architecture and internal workings of this library, please see the internal documentation.
$ composer install --no-dev
https://github.com/ryer/wpdump
MIT
ryer (@ryer)