PHPackages                             wundii/data-mapper-laravel-package - 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. wundii/data-mapper-laravel-package

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

wundii/data-mapper-laravel-package
==================================

A Laravel integration for wundii/data-mapper, modern and fast object mapper for PHP 8.2+. Strict types. Converts CSV, JSON, XML, YAML, NEON, arrays, and objects to PHP objects.

1.0.4(10mo ago)110[2 PRs](https://github.com/wundii/data-mapper-laravel-package/pulls)MITPHPPHP &gt;=8.2CI passing

Since Jun 19Pushed 1mo agoCompare

[ Source](https://github.com/wundii/data-mapper-laravel-package)[ Packagist](https://packagist.org/packages/wundii/data-mapper-laravel-package)[ RSS](/packages/wundii-data-mapper-laravel-package/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (16)Versions (13)Used By (0)

    ![wundii/data-mapper-laravel-package](https://raw.githubusercontent.com/wundii/data-mapper/refs/heads/main/assets/data-mapper-light.png)

[![PHP-Tests](https://camo.githubusercontent.com/6e68e3c896cbcbb725cb94005a0fac54c34dd5daded9b28c9142368bec4613ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167652f636f64655f7175616c6974792e796d6c3f6272616e63683d6d61696e267374796c653d666f722d7468652d6261646765)](https://github.com/wundii/data-mapper-laravel-package/actions/workflows/code_quality.yml)[![PHPStan](https://camo.githubusercontent.com/e15d364c7c0af383f9784d4af8419c1fcd87fbb5b44f0d48e32ce327be958008/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e2e7376673f7374796c653d666f722d7468652d6261646765)](https://phpstan.org/)[![VERSION](https://camo.githubusercontent.com/ae8571aaa94e042c60be9d2d34d75334b8dc23ca1751d6aa57970232b7e19baf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167653f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/ae8571aaa94e042c60be9d2d34d75334b8dc23ca1751d6aa57970232b7e19baf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167653f7374796c653d666f722d7468652d6261646765)[![PHP](https://camo.githubusercontent.com/bd0fad646ccca6976e8b34446d286cb949d7e813f704828adecfb4b106169d8f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167653f7374796c653d666f722d7468652d6261646765)](https://www.php.net/)[![Rector](https://camo.githubusercontent.com/bd6dd5b52a4347de5aa8bd284d980f474d87da595a4c90d3300b9645c2bcbf7f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f526563746f722d382e322d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](https://getrector.com)[![ECS](https://camo.githubusercontent.com/0f7ade62b75eb86dd60ed170f954932994f60c2b4678e94ad0c7a892d31d77b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4543532d636865636b2d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](https://tomasvotruba.com/blog/zen-config-in-ecs)[![PHPUnit](https://camo.githubusercontent.com/729283066c222d92f175922debb3efc12d423e06e2880f6cc08e9c8601764ff3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2d556e69742d636865636b2d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](https://phpunit.org)[![codecov](https://camo.githubusercontent.com/4193f1a9436a0bbaa24830d5d09d360ed338e8647f4f9a8813e8c8570635c867/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167652f6d61696e3f746f6b656e3d52314642574638554a44267374796c653d666f722d7468652d6261646765)](https://codecov.io/github/wundii/data-mapper-laravel-package)[![Downloads](https://camo.githubusercontent.com/1278ca82f38eb60c3eb0ade000902d57795839e9234b700ce499b2b82d5193bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77756e6469692f646174612d6d61707065722d6c61726176656c2d7061636b6167652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wundii/data-mapper-laravel-package)

A Laravel integration for [wundii/data-mapper](https://github.com/wundii/data-mapper). This library is an extremely fast and strictly typed object mapper built for modern PHP (8.2+). It seamlessly transforms data from formats like CSV, JSON, NEON, XML, YAML, array, and standard objects into well-structured PHP objects.

Ideal for developers who need reliable and efficient data mapping without sacrificing code quality or modern best practices.

Features
--------

[](#features)

- Mapping source data into objects
- Mapping source data with a list of elements into a list of objects
- Initialize object via constructor, properties or methods
- Map nested objects, arrays of objects
- Class mapping for interfaces or other classes
- Custom root element for starting with the source data
- Auto-casting for `float` types (eu to us decimal separator)
- Target alias via Attribute for properties and methods
- Automatic data sorting for constructor parameters

Supported Types
---------------

[](#supported-types)

- `null`
- `bool`|`?bool`
- `int`|`?int`
- `float`|`?float`
- `string`|`?string`
- `array`
    - `int[]`
    - `float[]`
    - `string[]`
    - `object[]`
- `object`|`?object`
- `enum`|`?enum`

Supported Formats
-----------------

[](#supported-formats)

optional formats are marked with an asterisk `*`

- `array`
- `csv`
- `json`
- `neon`\*
- `object`
    - `public property`
    - `public getters`
    - `method toArray()`
    - `attribute SourceData('...')`
- `xml`
- `yaml`\*

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

[](#installation)

Require the bundle and its dependencies with composer:

```
composer require wundii/data-mapper-laravel-package
```

Create a Laravel configuration file `config/data-mapper.php` with the command:

```
php artisan data-mapper:publish-config
```

Configuration File
------------------

[](#configuration-file)

The following setting options are available

```
