PHP code example of waaseyaa / migrate-source-wordpress

1. Go to this page and download the library: Download waaseyaa/migrate-source-wordpress library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

waaseyaa / migrate-source-wordpress example snippets


use Waaseyaa\Migrate\Source\WordPress\Migration\WpUsersToAccounts;
use Waaseyaa\Migrate\Source\WordPress\Migration\WpPostsToArticles;
use Waaseyaa\Migrate\Source\WordPress\Wxr\WxrReader;

$reader = new WxrReader('/path/to/wp-export.xml');

return [
    (new WpUsersToAccounts($reader, $yourAccountDestination))->definition(),
    (new WpPostsToArticles($reader, $yourArticleDestination))->definition(),
    // …users → terms → media → posts → comments, per FR-024
];
bash
docker run --rm -it php:8.5-cli bash
apt-get update && apt-get install -y git unzip libxml2-dev
docker-php-ext-install xml xmlreader
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
mkdir /tmp/smoke && cd /tmp/smoke
composer init -q --name=test/smoke --no-interaction
composer