PHPackages                             uuur86/dalue - 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. uuur86/dalue

ActiveLibrary[Database &amp; ORM](/categories/database)

uuur86/dalue
============

PHP Data mapper.

v0.1.1-beta(2y ago)153GPL-3.0-or-laterPHPPHP &gt;=7.2

Since May 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/uuur86/dalue)[ Packagist](https://packagist.org/packages/uuur86/dalue)[ RSS](/packages/uuur86-dalue/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

Dalue Mapper Class Usage
========================

[](#dalue-mapper-class-usage)

The `Mapper` class under the `Dalue` namespace offers a powerful and flexible method for data transformation and restructuring. This class allows you to create a new structure from a given data set, optionally performing transformations on the data in the process.

Getting Started
---------------

[](#getting-started)

Before you begin using the `Mapper` class, ensure that the library containing the `StrObj\StringObjects` class is installed. The `Mapper` class utilizes the functionalities provided by this class for data access and manipulation.

### Installation

[](#installation)

First, install the required packages via Composer:

```
composer require uuur86/dalue:0.1.1-beta
```

Example Usage
-------------

[](#example-usage)

Below is an example of how to use the `Mapper` class:

```
use Dalue\Mapper;
use StrObj\StringObjects;

// Sample data set
$data = new StringObjects([
    'user' => [
        'id' => 1,
        'name' => 'John Doe',
        'email' => 'john.doe@example.com',
        'details' => [
            'age' => 30,
            'city' => 'New York'
        ]
    ]
]);

// Defining the data structure we want to transform into.
$paths = [
    'userID' => '@data/user/id',
    'userName' => '@data/user/name',
    'userDetails' => [
        'userAge' => '@data/user/details/age',
        'userCity' => '@data/user/details/city'
    ]
];

// Using the Mapper::map function to perform the transformation.
$mappedData = Mapper::map($data, $paths);

print_r($mappedData);
```

### Explanation

[](#explanation)

1. **Data Initialization**:
    - A sample data set is created using the `StringObjects` class.
2. **Path Definition**:
    - The structure we want to transform into is defined in the `$paths` array.
3. **Data Transformation**:
    - The `Mapper::map` function is used to transform the data according to the defined paths.

### Output

[](#output)

The above example will produce the following output:

```
Array
(
    [userID] => 1
    [userName] => John Doe
    [userDetails] => Array
        (
            [userAge] => 30
            [userCity] => New York
        )
)
```

Advanced Usage
--------------

[](#advanced-usage)

You can also perform more complex transformations by incorporating custom functions in the mapping paths. Here is an example:

```
use Dalue\Mapper;
use StrObj\StringObjects;

$data = new StringObjects([
    'user' => [
        'id' => 1,
        'name' => 'John Doe',
        'email' => 'john.doe@example.com',
        'details' => [
            'age' => 30,
            'city' => 'New York'
        ]
    ]
]);

$paths = [
    'userID' => '@data/user/id',
    'userName' => '@data/user/name',
    'userEmail' => function($data) {
        return strtoupper($data->get('user.email'));
    },
    'userDetails' => [
        'userAge' => '@data/user/details/age',
        'userCity' => '@data/user/details/city',
        'description' => function($data) {
            return $data->get('user.details.age') . ' years old, lives in ' . $data->get('user.details.city');
        }
    ]
];

$mappedData = Mapper::map($data, $paths);

print_r($mappedData);
```

### Output

[](#output-1)

The advanced example will produce the following output:

```
Array
(
    [userID] => 1
    [userName] => John Doe
    [userEmail] => JOHN.DOE@EXAMPLE.COM
    [userDetails] => Array
        (
            [userAge] => 30
            [userCity] => New York
            [description] => 30 years old, lives in New York
        )
)
```

LICENSE
-------

[](#license)

This project is licensed under the GPL-3.0-or-later License. See the [LICENSE](LICENSE) file for more details.

AUTHOR
------

[](#author)

Uğur Biçer - [@uuur86](https://github.com/uuur86)

CONTRIBUTING
------------

[](#contributing)

If you want to contribute to this project, you can send pull requests. We expect all contributors to follow our [Code of Conduct](CONTRIBUTING.md).

CONTACT
-------

[](#contact)

You can contact me via email:

BUGS
----

[](#bugs)

You can report bugs via GitHub issues.

SECURITY
--------

[](#security)

If you find a security issue, please report it via email:

DONATE
------

[](#donate)

If you want to support me, you can donate via GitHub sponsors:

SEE ALSO
--------

[](#see-also)

- [uuur86/strobj](https://github.com/uuur86/strobj) - PHP String Objects
- [uuur86/wpoauth](https://github.com/uuur86/wpoauth) - WordPress OAuth2 Client
- [@codeplusdev](https://github.com/codeplusdev) - Codeplus Development

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

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

Total

2

Last Release

1082d ago

### Community

Maintainers

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

---

Top Contributors

[![uuur86](https://avatars.githubusercontent.com/u/17476001?v=4)](https://github.com/uuur86 "uuur86 (9 commits)")

---

Tags

data-manipulationmapperphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/uuur86-dalue/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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