PHPackages                             zolex/vom - 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. [Database &amp; ORM](/categories/database)
4. /
5. zolex/vom

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

zolex/vom
=========

Versatile Object Mapper. Map arbitrary data to strictly typed models using PHP attributes.

2.2.1(3mo ago)21137.6k3MITPHPPHP &gt;=8.2CI passing

Since Jan 31Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/zolex/vom)[ Packagist](https://packagist.org/packages/zolex/vom)[ RSS](/packages/zolex-vom/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (8)Versions (47)Used By (0)

Versatile Object Mapper
=======================

[](#versatile-object-mapper)

[![Release](https://github.com/zolex/vom/workflows/Release/badge.svg)](https://github.com/zolex/vom/actions/workflows/release.yaml)[![Version](https://camo.githubusercontent.com/ef88d6074cf6fcea986a368049e432990eff026cd0a09641057a9f3e4c90bc7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6f6c65782f766f6d)](https://packagist.org/packages/zolex/vom)[![Integration](https://github.com/zolex/vom/workflows/Integration/badge.svg)](https://github.com/zolex/vom/actions/workflows/integration.yaml)[![Code Coverage](https://camo.githubusercontent.com/b66f8135764c88db194372f600d92edcddfa32a960a88547b73e0a7d96045b7a/68747470733a2f2f636f6465636f762e696f2f67682f7a6f6c65782f766f6d2f67726170682f62616467652e7376673f746f6b656e3d5249324e583453383949)](https://codecov.io/gh/zolex/vom)[![License](https://camo.githubusercontent.com/edb14903373096bf89ebcbebb42f1e57cd6011ad6c1dba6f98d5296cba029b57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a6f6c65782f766f6d)](./LICENSE)[![Downloads](https://camo.githubusercontent.com/416f5a6115251e3eee158b110433d35537c51c17ccc6f596959635e3131966c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6f6c65782f766f6d)](https://packagist.org/packages/zolex/vom)

[![VOM](docs/logo.png)](docs/logo.png)

[![PHP](https://camo.githubusercontent.com/bbeaca4ecdd74d3fde840f711ebb8a5def2ff801187623f9bc365761b3b66f86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2532333737374242342e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/bbeaca4ecdd74d3fde840f711ebb8a5def2ff801187623f9bc365761b3b66f86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2532333737374242342e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![Symfony](https://camo.githubusercontent.com/75640a8af2eb1f88bec55acdbfd1052c4a4734b55418179bbbc411a4bd0374ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d2532333030303030302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d73796d666f6e79266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/75640a8af2eb1f88bec55acdbfd1052c4a4734b55418179bbbc411a4bd0374ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d2532333030303030302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d73796d666f6e79266c6f676f436f6c6f723d7768697465)[![Laravel](https://camo.githubusercontent.com/4a98123f3416c1e91b1616838d42e4bd5231f0a31c00b024a4d56168f22c1603/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d2532334646324432302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/4a98123f3416c1e91b1616838d42e4bd5231f0a31c00b024a4d56168f22c1603/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d2532334646324432302e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)

The Versatile Object Mapper - or in short VOM - is a PHP library to transform any data structure into strictly typed models (and back) by adding PHP 8 attributes. It extends symfony/serializer functionality and is heavily inspired by doctrine and API-Platform, so that advanced mappings can simply be defined on the model classes instead of writing normalizer decorators.

- [Documentation](https://zolex.github.io/vom/)
- [Examples repository](https://github.com/zolex/vom-examples).

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

[](#installation)

VOM is available on packagist. To install, simply require it via composer.

```
composer require zolex/vom ^2.0
```

Quickstart
----------

[](#quickstart)

To give you a basic idea of what VOM does, here is a first short example.

Given, your application receives the following array of values from somewhere.

```
$data = [
    'firstname' => 'Jane',
    'surname' => 'Doe',
    'street' => 'Samplestreet 123',
    'city' => 'Worsthausen',
    'zip' => '12345',
    'country_name' => 'United Kingdom',
    'email_address' => 'jane.doe@mailprovider.net',
    'phone' => '0123456789'
];
```

Usually you would write some code that creates the model instances, sets their properties and nests them properly. In very simple scenarios, writing the transformation logic as code might be a good choice, but it can be a pain when it comes to very huge models, the input data structures and/or application models change while still in development, or if you want to reuse the transformation logic in other projects too, because it receives the same inputs and/or uses the same models.

### How it works using VOM

[](#how-it-works-using-vom)

Instead of writing business logic that feeds your models, with VOM you simply configure the models using PHP attributes.

```
use Zolex\VOM\Mapping as VOM;

#[VOM\Model]
class Person
{
    #[VOM\Property]
    public string $firstname;

    #[VOM\Property('[surname]')]
    public string $lastname;

    #[VOM\Property(accessor: false)]
    public Address $address;

    #[VOM\Property(accessor: false)]
    public Contact $contact;
}

#[VOM\Model]
class Address
{
    #[VOM\Property]
    public string $street;

    #[VOM\Property('[zip]')]
    public string $zipCode;

    #[VOM\Property]
    public string $city;

    #[VOM\Property('[country_name]')]
    public string $country;
}

#[VOM\Model]
class Contact
{
    #[VOM\Property('[email_address]')]
    public string $email;

    #[VOM\Property]
    public string $phone;
}
```

To create instances of your models, you simply pass the data to the `denormalize()` method.

```
$person = $objectMapper->denormalize($data, Person::class);
```

You may have noticed, that some property attributes have arguments while others don't. For all details on that, head to the [full documentation](https://zolex.github.io/vom/).

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Contributors
------------

[](#contributors)

    [ ![zolex](https://camo.githubusercontent.com/d1eea90ccc0a7398b2bb7c90608aa7e29ceb63f8a53c90901524768564a8816d/68747470733a2f2f696d616765732e7765736572762e6e6c2f3f75726c3d617661746172732e67697468756275736572636f6e74656e742e636f6d2f752f3339383733393f763d3426683d373526773d3735266669743d636f766572266d61736b3d636972636c65266d61786167653d3764)
 **Andreas Linden** ](https://github.com/zolex)   [ ![zolex](https://camo.githubusercontent.com/082fdf3adeffe0a5eb78903087425d54b099ddaeb387a2c41f135dd1b9f475d2/68747470733a2f2f696d616765732e7765736572762e6e6c2f3f75726c3d617661746172732e67697468756275736572636f6e74656e742e636f6d2f752f31363034303733343f763d3426683d373526773d3735266669743d636f766572266d61736b3d636972636c65266d61786167653d3764)
 **Javier Caballero**  ](https://github.com/sengaigibon)   Special thanks
--------------

[](#special-thanks)

To [Blackfire.io](https://blackfire.io) for supporting this project with a free license. Their tools help to identify optimization opportunities and provide valuable insights into the current performance characteristics of VOM.

[ ![Blackfire](./docs/blackfire.png)](https://blackfire.io)*Performance comparison between cached and uncached VOM metadata across 1000 iterations of denormalizing the same model. See [tests/Profiling](tests/Profiling).*

Alternatives
------------

[](#alternatives)

There are many Mapping/Transformation/Hydration libraries out there. In case you don't want to rely on `symfony/serializer`, `symfony/proerty-access`, `symfony/type-info` and `phpdocumentor/reflection-docblock` which VOM depends on, here are some alternative packages that cover the same topic with quite different approaches and features.

- [jms/serializer](https://github.com/schmittjoh/serializer)
- [CuyZ/Valinor](https://github.com/CuyZ/Valinor)
- [rekalogika/mapper](https://github.com/rekalogika/mapper)
- [Crell/Serde](https://github.com/Crell/Serde)
- [thephpleague/object-mapper](https://github.com/thephpleague/object-mapper)
- [eventsauce/object-hydrator](https://github.com/EventSaucePHP/ObjectHydrator)
- [spatie/laravel-data](https://github.com/spatie/laravel-data)

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

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

Every ~18 days

Recently: every ~4 days

Total

44

Last Release

101d ago

Major Versions

0.10.0 → 1.0.02025-05-22

1.2.0 → 2.0.02026-01-02

PHP version history (2 changes)0.0.1PHP &gt;=8.1

2.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/398739?v=4)[Andreas Linden](/maintainers/zolex)[@zolex](https://github.com/zolex)

---

Top Contributors

[![zolex](https://avatars.githubusercontent.com/u/398739?v=4)](https://github.com/zolex "zolex (324 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

data-structureshydrationmappingnormalizationtransformation

### Embed Badge

![Health badge](/badges/zolex-vom/health.svg)

```
[![Health](https://phpackages.com/badges/zolex-vom/health.svg)](https://phpackages.com/packages/zolex-vom)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M314](/packages/api-platform-core)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1237.8M120](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51390.8k2](/packages/web-auth-webauthn-framework)[api-platform/openapi

Models to build and serialize an OpenAPI specification.

374.2M77](/packages/api-platform-openapi)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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