Download the PHP package istogram/wp-api-content-migration without Composer

On this page you can find all versions of the php package istogram/wp-api-content-migration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-api-content-migration

Wordpress API Content Migration

This Acorn package provides Artisan commands to migrate a WP site's content using the WP REST API.

Installation

You can install this package with Composer:

You can publish the config file with:

Configuration

Allow SVG media uploads

If you want to allow SVG media uploads you will need to set the config option:

WooCommerce products

The package can migrate WooCommerce products, product categories, product tags and variations via the WooCommerce REST API (wc/v3). This requires a few things:

The full set of supported variables is documented in config/content-migration.php. Provide them through your host application's environment — in a Bedrock project that is the project-root .env, which Acorn reads via the env() helper. Never commit real credentials.

Credentials are sent as an HTTP Basic Auth header over HTTPS. If your source server strips the Authorization header (you'll see a "Consumer key is missing" error), set WC_MIGRATION_QUERY_STRING_AUTH=true to send them as query-string parameters instead.

For best results, migrate media before products so product images are linked to already-imported attachments; any image that isn't found is sideloaded as a fallback.

Product migration can be disabled entirely with WC_MIGRATION_ENABLED=false (this also disables customer migration below).

WooCommerce customers

Registered WooCommerce customers are migrated via the wc/v3/customers endpoint using the same credentials as products. For each customer a WordPress user (role customer) is created with their email, name, and billing/shipping addresses.

Passwords are not migrated. The REST API does not expose password hashes, so each imported account is given a random password and users must reset their password to log in — notify them out-of-band. To make this safe on a dev/staging box, all outgoing email is suppressed while customers are created, so no account or notification emails are ever sent.

Accounts are de-duplicated by email and login: if a matching user already exists locally (e.g. an admin, or a previous run) it is mapped and left untouched rather than duplicated.

Privacy note: this copies real customer PII (emails, addresses) into your local database. Make sure that's acceptable for your environment.

WooCommerce orders

Orders are migrated via wc/v3/orders and recreated through WooCommerce's WC_Order CRUD. Order migration runs after products and customers, because each order's line items and customer are remapped to the local product/variation/user ids (unmapped references keep the order's own snapshot data, so nothing is lost). Guest orders are preserved with customer_id 0.

Each order is reproduced in full — product, shipping, fee, coupon and tax lines — and all totals are copied verbatim; they are never recalculated, so historical orders keep their original amounts even if product prices or tax rates have since changed. Status, dates, payment method and transaction id are preserved.

While orders are being created, all outgoing email is suppressed and stock mutation is disabled, so recreating historical orders never emails customers or alters product stock levels.

Order clearing (and the id mapping) works with both classic post-based storage and HPOS (High-Performance Order Storage).

Privacy note: orders are the heaviest payload — full purchase history, addresses and payment metadata. Only migrate them into environments where that data is acceptable.

Not yet migrated: order refunds and order notes are out of scope for now, as are coupons (as reusable coupon definitions — coupon lines on an order are preserved). Global attribute taxonomies (pa_*) are imported as custom, product-level attributes rather than recreated as global attributes.

Usage

To migrate WP content from a WP site, using the WP REST API, to the local site use this command replacing {domain} with the domain of the Live WP site :

When no options are applied, the command will proceed step by step, asking for confirmation before each step is applied.

If you want to clear the current taxonomies, media, posts and pages of the local site you may use this option :

You may also use this option if you want to migrate all WP content without confirmations :

Please be aware that if you choose to clear any of the existing taxonomies, media, posts, pages, WooCommerce products, customers or orders this will delete entirely all the relevant content from the local site DB. This action is irreversible, so it's safer to have a DB backup first. (Clearing customers and orders only removes records that were imported by this package — pre-existing accounts such as admins, and locally created orders, are left intact.)


All versions of wp-api-content-migration with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package istogram/wp-api-content-migration contains the following files

Loading the files please wait ...