PHPackages                             evispa/object-migration - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. evispa/object-migration

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

evispa/object-migration
=======================

Migrations between object versions, configurable via annotations.

1351PHP

Since Sep 12Pushed 12y ago5 watchersCompare

[ Source](https://github.com/evispa/object-migration)[ Packagist](https://packagist.org/packages/evispa/object-migration)[ RSS](/packages/evispa-object-migration/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Object migration library
------------------------

[](#object-migration-library)

Build Status: [![Build Status](https://camo.githubusercontent.com/44ee416f6ad8572b04d4a8bd6e65bfaec6ec7bcea5148b57b3ff6f4d89c6abc9/687474703a2f2f6465762e6576697370612e6c743a38312f6275696c645374617475732f69636f6e3f6a6f623d6576697370612d6f626a6563742d6d6967726174696f6e)](https://camo.githubusercontent.com/44ee416f6ad8572b04d4a8bd6e65bfaec6ec7bcea5148b57b3ff6f4d89c6abc9/687474703a2f2f6465762e6576697370612e6c743a38312f6275696c645374617475732f69636f6e3f6a6f623d6576697370612d6f626a6563742d6d6967726174696f6e)

Overview
--------

[](#overview)

Migrate objects to different versions based on version annotations.

For example, let's say we have two class versions, the second one modifies public field name from "slug" to "id":

```
class V1
{
    public $slug;
}

class V2
{
    public $id;
}
```

We can then decorate these classes with version annotations, and create migration method to the new version:

```
use Evispa\ObjectMigration\Annotations as Api;

/**
 * @Api\Version("object.v1")
 */
class V1
{
    public $slug;
}

/**
 * @Api\Version("object.v2")
 */
class V2
{
    public $id;

    /**
     * @Api\Migration(from="V1")
     */
    public static function fromV1(V1 $other, $options) {
        $obj = new self();

        $obj->id = $other->slug;

        return $obj;
    }
}
```

Use VersionConverter tool to check object version or migrate object to another available version:

```
use Doctrine\Common\Annotations\AnnotationReader;
use Evispa\ObjectMigration\VersionReader;
use Evispa\ObjectMigration\VersionConverter;

$converter = new VersionConverter(new VersionReader(new AnnotationReader()), 'V2');

// create v1 object

$v1 = new V1();
$v1->slug = "TEST";

// migrate to another version

$v2 = $converter->migrateFrom($v1);

$this->assertTrue($v2 instanceof V2); // true
$this->assertEquals("TEST", $v2->id); // true
```

Requirements
------------

[](#requirements)

This library will use:

- doctrine/annotations for annotation parsing
- clue/graph for version migrations search

Installation
------------

[](#installation)

This library can be easily installed via composer

```
composer require evispa/object-migration
```

or just add it to your `composer.json` file directly.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.3% 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.

### Community

Maintainers

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

![](https://avatars.githubusercontent.com/u/2358146?v=4)[Darius Krištapavičius](/maintainers/dariuszz123)[@dariuszz123](https://github.com/dariuszz123)

---

Top Contributors

[![dariuszz123](https://avatars.githubusercontent.com/u/2358146?v=4)](https://github.com/dariuszz123 "dariuszz123 (18 commits)")[![Nercury](https://avatars.githubusercontent.com/u/106180?v=4)](https://github.com/Nercury "Nercury (10 commits)")

### Embed Badge

![Health badge](/badges/evispa-object-migration/health.svg)

```
[![Health](https://phpackages.com/badges/evispa-object-migration/health.svg)](https://phpackages.com/packages/evispa-object-migration)
```

###  Alternatives

[spatie/statamic-responsive-images

Responsive Images for Statamic

115250.6k](/packages/spatie-statamic-responsive-images)[mainwp/mainwp-child

This is the Child plugin for the MainWP Dashboard

973.4k](/packages/mainwp-mainwp-child)[casinelli/currency

Handles currency for Laravel 5.

1711.8k](/packages/casinelli-currency)

PHPackages © 2026

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