2017 © Pedro Peláez
 

library uxdm

UXDM helps developers migrate data from one system or format to another.

image

rapidwebltd/uxdm

UXDM helps developers migrate data from one system or format to another.

  • Monday, April 16, 2018
  • by DivineOmega
  • Repository
  • 5 Watchers
  • 2 Stars
  • 315 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 50 Versions
  • 8 % Grown

The README.md

🔀 Universal Extensible Data Migrator (UXDM)

Build Status Coverage Status StyleCI Packagist, (*1)

UXDM helps developers migrate data from one system or format to another., (*2)

Installation

UXDM can be easily installed using Composer. Just run the following command from the root of your project., (*3)

composer require rapidwebltd/uxdm

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started., (*4)

Migrations

Each UXDM migration requires a source object and at least one destination object. These determine where and how data is read and written. The UXDM package comes with a variety of source and destination objects, including the following., (*5)

  • PDO (PHP Database Object) Source & Destination
  • CSV (Comma Seperated Values) Source & Destination
  • Associative Array Source & Destination
  • JSON Files Source & Destination
  • XML Source & Destination
  • WordPress Post Source
  • WordPress User Source
  • Debug Output Destination

Source and destination objects can be used in any combination. Data can be migrated from a CSV and inserted into a database, just as easily as data can be migrated from a database to a CSV., (*6)

You can also use similar source and destination objects in the same migration. For example, a common use of UXDM is to use a PDO source and PDO destination to transfer data from one database to another., (*7)

Please see the Sources & Destinations page for more detailed documentation on their usage., (*8)

Examples

Database to database migration

An example of a basic database to database UXDM migration is shown below., (*9)

$pdoSource = new PDOSource(new PDO('mysql:dbname=old-test;host=127.0.0.1', 'root', 'password123'), 'users');

$pdoDestination = new PDODestination(new PDO('mysql:dbname=new-test;host=127.0.0.1', 'root', 'password456'), 'new_users');

$migrator = new Migrator;
$migrator->setSource($pdoSource)
         ->setDestination($pdoDestination)
         ->setFieldsToMigrate(['id', 'email', 'name'])
         ->setKeyFields(['id'])
         ->migrate();

This migration will move the id, email and name fields from the the users table in the old-test database, to the new_users table in the new-test database, replacing any existing records with the same id (the key field)., (*10)

Mapping field names from source to destination

This examples shows how UXDM can map field names from source to destination., (*11)

$migrator = new Migrator;
$migrator->setSource($pdoSource)
         ->setDestination($pdoDestination)
         ->setFieldsToMigrate(['id', 'email', 'name'])
         ->setKeyFields(['id'])
         ->setFieldMap(['name' => 'full_name'])
         ->migrate();

This migration will move data from the source name field into the destination full_name field, while still moving the id and email fields normally., (*12)

Modifying data items during migration

The following example shows how you can use UXDM to modify items of data during the migration process., (*13)

$migrator = new Migrator;
$migrator->setSource($pdoSource)
         ->setDestination($pdoDestination)
         ->setFieldsToMigrate(['id', 'email', 'name'])
         ->setKeyFields(['id'])
         ->setDataItemManipulator(function($dataItem) {
            if ($dataItem->fieldName=='name') {
                $dataItem->value = strtoupper($dataItem->value);
            }
         })
         ->migrate();

This migration will move user data between two databases. However, it will also convert the value in the name field to uppercase., (*14)

Modifying data rows during migration

Adding data items

This examples shows how UXDM can modify each row of data while the migration is taking place., (*15)

$migrator = new Migrator;
$migrator->setSource($pdoSource)
         ->setDestination($pdoDestination)
         ->setFieldsToMigrate(['id', 'email', 'name'])
         ->setKeyFields(['id'])
         ->setDataRowManipulator(function($dataRow) {
            $dataRow->addDataItem(new DataItem('random_number', rand(1,1000)));
         })
         ->migrate();

This migration will add a random number into a field called random_number for each row of data. This will then be migrated to the destination database along with the other fields., (*16)

Removing data items

This example demonstrates how data items can be removed from a data row. You may wish to do this if you want to use its value, but not actually migrate it to the destination., (*17)

$migrator = new Migrator;
$migrator->setSource($pdoSource)
         ->setDestination($pdoDestination)
         ->setFieldsToMigrate(['id', 'email', 'name'])
         ->setKeyFields(['id'])
         ->setDataRowManipulator(function($dataRow) {
            $emailDataItem = $dataRow->getDataItemByFieldName('email');
            $dataRow->addDataItem(new DataItem('email_hash', md5($emailDataItem->value)));
            $dataRow->removeDataItem($emailDataItem);
         })
         ->migrate();

This migration gets the data from the email field in the source, creates a new email_hash data item which contains an md5 of the email address, and then removes the original email data item. This new email_hash will then be migrated to the destination database along with the other fields, excluding the removed email field., (*18)

The Versions

16/04 2018

dev-master

9999999-dev

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL3 LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

16/04 2018

v1.23.0

1.23.0.0

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

16/04 2018

v1.22.0

1.22.0.0

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

v1.21.0

1.21.0.0

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

v1.20.1

1.20.1.0

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

dev-analysis-X05k4x

dev-analysis-X05k4x

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

dev-analysis-qy9Ao2

dev-analysis-qy9Ao2

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

v1.20.0

1.20.0.0

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

28/03 2018

dev-analysis-qoOAvK

dev-analysis-qoOAvK

UXDM helps developers migrate data from one system or format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

02/03 2018

v1.19.1

1.19.1.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

27/02 2018

v1.19.0

1.19.0.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

12/02 2018

v1.18.0

1.18.0.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

02/02 2018

v1.17.5

1.17.5.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

02/02 2018

dev-analysis-zDmPbl

dev-analysis-zDmPbl

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

30/01 2018

v1.17.4

1.17.4.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

24/01 2018

v1.17.3

1.17.3.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

24/01 2018

v1.17.2

1.17.2.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

18/01 2018

v1.17.1

1.17.1.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

18/01 2018

v1.17.0

1.17.0.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

12/01 2018

v1.16.1

1.16.1.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

12/01 2018

v1.16.0

1.16.0.0

Universal Extensible Data Migrator (UXDM) is a PHP package designed to help developers migrate data from one system/format to another.

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

24/09 2017

v1.15.5

1.15.5.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

30/08 2017

v1.15.4

1.15.4.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

22/08 2017

v1.15.3

1.15.3.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

22/08 2017

v1.15.2

1.15.2.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

22/08 2017

v1.15.1

1.15.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

21/08 2017

v1.15.0

1.15.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

08/08 2017

v1.14.2

1.14.2.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

08/08 2017

v1.14.1

1.14.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

08/08 2017

v1.14.0

1.14.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Requires

 

The Development Requires

by Jordan Hall

28/07 2017

v1.13.0

1.13.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

19/07 2017

v1.12.0

1.12.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

13/07 2017

v1.11.3

1.11.3.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

12/07 2017

v1.11.2

1.11.2.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

15/06 2017

v1.11.1

1.11.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

14/06 2017

v1.11.0

1.11.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

09/06 2017

v1.10.0

1.10.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

06/06 2017

v1.9.0

1.9.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

The Development Requires

by Jordan Hall

19/05 2017

v1.8.0

1.8.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

17/05 2017

v1.7.0

1.7.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

15/05 2017

v1.6.1

1.6.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

15/05 2017

v1.6.0

1.6.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

15/05 2017

v1.5.0

1.5.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.4.0

1.4.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.3.0

1.3.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.2.1

1.2.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.2.0

1.2.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.1.1

1.1.1.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.1.0

1.1.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall

12/05 2017

v1.0.0

1.0.0.0

Universal Extensible Data Migrator

  Sources   Download

LGPL3

by Jordan Hall