PHPackages                             mohmann/array-transform - 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. mohmann/array-transform

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

mohmann/array-transform
=======================

Transforms raw arrays from a given source mapping and back again

v0.0.3(7y ago)3185MITPHPPHP ^7.1

Since Jul 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/martinohmann/array-transform)[ Packagist](https://packagist.org/packages/mohmann/array-transform)[ RSS](/packages/mohmann-array-transform/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (9)Versions (4)Used By (0)

array-transform
===============

[](#array-transform)

[![Latest Stable Version](https://camo.githubusercontent.com/106e6d0eb4440a8cdf478391d5492f496e0fb2dfa42519c8c7449716e8fdb74d/68747470733a2f2f706f7365722e707567782e6f72672f6d6f686d616e6e2f61727261792d7472616e73666f726d2f762f737461626c65)](https://packagist.org/packages/mohmann/array-transform)[![Build Status](https://camo.githubusercontent.com/38cc4f23531ac5fcfc6c140f8ef88f55a19533e57f35237fe82a50b4c4260a35/68747470733a2f2f7472617669732d63692e6f72672f6d617274696e6f686d616e6e2f61727261792d7472616e73666f726d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/martinohmann/array-transform)[![Coverage Status](https://camo.githubusercontent.com/c448f52bb3fc10d4858db2d8f8f6ed89c061d0c636f77ae2ca4fff7d5aa7e0f9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d617274696e6f686d616e6e2f61727261792d7472616e73666f726d2f62616467652e737667)](https://coveralls.io/github/martinohmann/array-transform)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![PHP 7.1+](https://camo.githubusercontent.com/e6556d680d7fcf917890d04219d10f99ae03b29748d031fba63cb2e2538efeea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e312532422d626c75652e737667)](https://packagist.org/packages/mohmann/array-transform)

Transforms raw arrays from a given source mapping to a target mapping and back again.

This package requires **PHP 7.1 or higher**.

Quick example. Given the following YAML mapping:

```
---
mapping:
  foo[int]:
    inverse: bar.baz[float]
    formula:
      direct: bar.baz / 1000
      inverse: foo * 1000

```

A php array that looks like this (1):

```
[
    'bar' [
        'baz' => 1000.0
    ],
];

```

... transforms to this (2) (`transform`):

```
[
    'foo' => 1;
];

```

... and can be transformed back to its original form (`reverseTransform`)\*

```
[
    'bar' [
        'baz' => 1000.0
    ],
];

```

Simple formulas and type definitions are some of the "advanced" features of array-transform. Please refer to the documentation for more details.

\*There are weird mapping cases where a `reverseTransform` is not possible. Refer to the documentation for details.

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

[](#installation)

Via composer:

```
composer require mohmann/array-transform

```

Usage
-----

[](#usage)

WIP. Check the `examples/` directory for now.

Documentation
-------------

[](#documentation)

WIP. Check the `doc/` directory for a [mapping example](doc/full-mapping.yaml).

Development / Testing
---------------------

[](#development--testing)

Refer to the `Makefile` for helpful commands, e.g.:

```
make stan
make test
make inf

```

License
-------

[](#license)

array-transform is released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~2 days

Total

3

Last Release

2853d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1335045?v=4)[Martin Ohmann](/maintainers/martinohmann)[@martinohmann](https://github.com/martinohmann)

---

Top Contributors

[![martinohmann](https://avatars.githubusercontent.com/u/1335045?v=4)](https://github.com/martinohmann "martinohmann (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mohmann-array-transform/health.svg)

```
[![Health](https://phpackages.com/badges/mohmann-array-transform/health.svg)](https://phpackages.com/packages/mohmann-array-transform)
```

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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