PHPackages                             netglue/prismic-migration-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. netglue/prismic-migration-client

ActiveLibrary[API Development](/categories/api)

netglue/prismic-migration-client
================================

1.0.x-dev(1y ago)0116[1 PRs](https://github.com/netglue/prismic-migration-client/pulls)MITPHPPHP ~8.3 || ~8.4CI passing

Since Feb 18Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/netglue/prismic-migration-client)[ Packagist](https://packagist.org/packages/netglue/prismic-migration-client)[ RSS](/packages/netglue-prismic-migration-client/feed)WikiDiscussions 1.0.x Synced today

READMEChangelogDependencies (17)Versions (3)Used By (0)

Prismic Migration API PHP Client
================================

[](#prismic-migration-api-php-client)

This is a client for Prismic.io's Migration API.

You can find documentation on the API at [prismic.io/docs/migration-api-technical-reference](https://prismic.io/docs/migration-api-technical-reference)

Install
-------

[](#install)

```
composer require netglue/prismic-migration-client
```

Usage
-----

[](#usage)

You'll need to construct the concrete client yourself with all of its required dependencies:

- A [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP Client such as [php-http/curl-client](https://github.com/php-http/curl-client)
- [PSR-7](https://www.php-fig.org/psr/psr-7/) implementations with [PSR-17](https://www.php-fig.org/psr/psr-17/) Stream Factory, Request Factory and Uri Factory such as [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros/)

You will need a write api token for the target repo and one of the "Demo API Keys" whatever the fuck they are. You can find them here:

Assuming you have a PSR-11 container set up, you might be able to do something like this in a factory:

```
use Prismic\Migration\MigrationClientImplementation;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;

$client = new MigrationClientImplementation(
    'some-write-token',
    'some-repo-name',
    'some-demo-api-key',
    $container->get(ClientInterface::class),
    $container->get(RequestFactoryInterface::class),
    $container->get(UriFactoryInterface::class),
    $container->get(StreamFactoryInterface::class),
);
```

There's also a client shipped for the document read api which is a simplified client designed for fetching the source documents with minimum of fuss and in an easily serializable state.

```
use Prismic\Migration\DocumentClientImplementation;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;

$client = new DocumentClientImplementation(
    'some-read-token-or-null', // Token can be null here if your read api doesn't require one
    'repo-name',
    $container->get(ClientInterface::class),
    $container->get(RequestFactoryInterface::class),
    $container->get(UriFactoryInterface::class),
);
```

Basic Functionality
-------------------

[](#basic-functionality)

### Create Document

[](#create-document)

Create a document using the shipped value object `MigrationDocument`:

```
use Prismic\Migration\DocumentClient;
use Prismic\Migration\MigrationClient;
use Prismic\Migration\Model\MigrationDocument;

$readClient = $container->get(DocumentClient::class);
assert($readClient instanceof DocumentClient);

$migrationClient = $container->get(MigrationClient::class);
assert($migrationClient instanceof MigrationClient);

$document = $readClient->findById('some-document-id');

$migrationDoc = new MigrationDocument(
    'Make up a title or figure it out from content',
    $document->type,
    $document->uid,
    $document->lang,
    $document->data,
);

$result = $migrationClient->createDocument($migrationDoc);
```

### Update Already Migrated Document

[](#update-already-migrated-document)

```
use Prismic\Migration\MigrationClient;
use Prismic\Migration\Model\Document;
use Prismic\Migration\Model\MigrationDocumentPatch;
use Prismic\Migration\Model\MigrationResult;

assert($migrationClient instanceof MigrationClient);
assert($document instanceof Document);
assert($result instanceof MigrationResult);

$patch = new MigrationDocumentPatch(
    $result->id,
    $document->uid, // No idea if this can be mutated or not
    $document->data, // The entire payload of the source document is required
    $document->tags, // You must repeat existing tags or they will be removed
    'Updated Title', // Or null to leave it alone
);

$result = $migrationClient->updateDocument($patch);
```

Patching docs seems pointless given its design - you're better off sending the data you want first time with `createDocument`.

### Document Read API Client

[](#document-read-api-client)

The read-api client has two methods:

- `findById(non-empty-string): Document`
- `findAll(): list`

It will use the current `master` ref, so you'll need to ensure that anything you want to migrate is published already.

Contributing
------------

[](#contributing)

Please feel free to get involved with development. The project uses PHPUnit for tests, and [Psalm](https://psalm.dev) and [PHPStan](https://phpstan.org) for static analysis. CI should have your back if you want to submit a feature or fix ;)

License
-------

[](#license)

[MIT Licensed](LICENSE.md).

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance65

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

501d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6c21b0de8cc9938916a186f5f2ed0bee90a4e23e0b29cf7b9c18bfe99067f9b?d=identicon)[netglue](/maintainers/netglue)

---

Top Contributors

[![gsteel](https://avatars.githubusercontent.com/u/2803720?v=4)](https://github.com/gsteel "gsteel (5 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/netglue-prismic-migration-client/health.svg)

```
[![Health](https://phpackages.com/badges/netglue-prismic-migration-client/health.svg)](https://phpackages.com/packages/netglue-prismic-migration-client)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
