Important
This repository is a read-only mirror of packages/migration in appwrite/appwrite. Development happens there — please open issues and pull requests against appwrite/appwrite.
Utopia Migration is a simple and lite library to migrate and transform resources in-between services. This library is aiming to be as simple and easy to learn and use. This library is maintained by the Appwrite team.
Although this library is part of the Utopia Framework project it is dependency free and can be used as standalone with any other PHP project or framework.
Install using composer:
composer require utopia-php/migrationInit in your application:
<?php
use Utopia\Migration\Destinations\Local;
use Utopia\Migration\Resource;
use Utopia\Migration\Sources\NHost;
use Utopia\Migration\Transfer;
require_once __DIR__ . '/vendor/autoload.php';
// Initialize your Source
$source = new NHost('subdomain', 'eu-central-1', 'admin-secret', 'database-name', 'username', 'password');
// Initialize your Destination
$destination = new Local(__DIR__ . '/backup');
// Initialize Transfer
$transfer = new Transfer($source, $destination);
// Transfer the resources you want
$transfer->run(
[Resource::TYPE_USER],
function (array $resources) {
foreach ($resources as $resource) {
echo $resource->getName() . ' ' . $resource->getId() . ': ' . $resource->getStatus() . PHP_EOL;
}
}
);The Appwrite destination writes to the destination project's databases as well as its API, so it also takes the project's database handles; see Destinations\Appwrite::__construct().
Sources:
| Auth | Databases | Storage | Functions | Settings | |
|---|---|---|---|---|---|
| Appwrite | ✅ | ✅ | ✅ | ✅ | |
| Supabase | ✅ | ✅ | ✅ | ||
| NHost | ✅ | ✅ | ✅ | ||
| Firebase | ✅ | ✅ | ✅ |
Destinations:
| Auth | Databases | Storage | Functions | Settings | |
|---|---|---|---|---|---|
| Appwrite | ✅ | ✅ | ✅ | ✅ | |
| Local | ✅ | ✅ | ✅ | ✅ | ✅ |
Warning The Local destination should be used for testing purposes only. It is not recommended to use this destination in production or as a backup. The local destination is there to confirm that a source is working correctly and to test the migration process with needing a target destination instance. This may change in the future however as the library matures.
Utopia Migration requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php