PHPackages                             jerodev/data-mapper - 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. jerodev/data-mapper

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

jerodev/data-mapper
===================

Maps raw data to a typed PHP object

1.2.1(2y ago)171.4k[1 PRs](https://github.com/jerodev/data-mapper/pulls)MITPHPPHP ^8.1CI passing

Since May 30Pushed 5mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

Data Mapper
===========

[](#data-mapper)

[![run-tests](https://github.com/jerodev/data-mapper/workflows/run-tests/badge.svg)](https://github.com/jerodev/data-mapper/workflows/run-tests/badge.svg) [![Latest Stable Version](https://camo.githubusercontent.com/c9705970f3f38bef5b1ccff66c7560c881c485a5793e908ae58660f3ca2bb859/687474703a2f2f706f7365722e707567782e6f72672f6a65726f6465762f646174612d6d61707065722f76)](https://packagist.org/packages/jerodev/data-mapper)

This package will map any raw data into a predefined strong-typed PHP object.

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

[](#installation)

The mapper has no external dependencies apart from PHP8.1 or higher. It can be installed using composer:

```
composer require jerodev/data-mapper
```

Basic mapping
-------------

[](#basic-mapping)

Let's start with the basics. The mapper will map data directly to public properties on objects. If these properties have types defined either using types introduced in PHP7.4 or through [PHPDoc](https://phpstan.org/writing-php-code/phpdoc-types), the mapper will attempt to cast the data to these types.

For example: imagine having an `Entity` class with the public properties `$id` and `$name`:

```
class User
{
    public int $id;
    public string $name;
}
```

To map data from an array we simply pass the class name and an array with data to the mapper.

```
$mapper = new \Jerodev\DataMapper\Mapper();
$entity = $mapper->map(User::class, [
    'id' => '5',
    'name' => 'John Doe',
]);

//    User {
//        +id: 5,
//        +name: "John Doe",
//    }
```

This is a simple example, but the mapper can also map nested objects, arrays of objects, keyed arrays, and even multi-level arrays.

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

[](#documentation)

More information about mapping, configuration and best practices can be found in [the documentation](https://docs.deviaene.eu/data-mapper/).

License
-------

[](#license)

This library is licensed under the MIT License (MIT). Please see [License File](license.md) for more information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance48

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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 ~73 days

Total

4

Last Release

898d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3493941?v=4)[Jeroen Deviaene](/maintainers/jerodev)[@jerodev](https://github.com/jerodev)

---

Top Contributors

[![jerodev](https://avatars.githubusercontent.com/u/3493941?v=4)](https://github.com/jerodev "jerodev (98 commits)")

---

Tags

classesjsonobjectsphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jerodev-data-mapper/health.svg)

```
[![Health](https://phpackages.com/badges/jerodev-data-mapper/health.svg)](https://phpackages.com/packages/jerodev-data-mapper)
```

PHPackages © 2026

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