PHPackages                             fastnorth/property-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. fastnorth/property-mapper

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

fastnorth/property-mapper
=========================

Transforms data structures

1.0.2(2y ago)548.1k1[2 issues](https://github.com/fastnorth/property-mapper/issues)[2 PRs](https://github.com/fastnorth/property-mapper/pulls)MITPHPCI passing

Since Nov 19Pushed 1mo ago24 watchersCompare

[ Source](https://github.com/fastnorth/property-mapper)[ Packagist](https://packagist.org/packages/fastnorth/property-mapper)[ RSS](/packages/fastnorth-property-mapper/feed)WikiDiscussions master Synced 2mo ago

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

Property Mapper
===============

[](#property-mapper)

[![Build Status](https://camo.githubusercontent.com/97c884c234b2c5961fbf0f540392ae714842f999edd873daa9bcc35b6647e46a/68747470733a2f2f7472617669732d63692e6f72672f666173746e6f7274682f70726f70657274792d6d61707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/fastnorth/property-mapper)[![Code Climate](https://camo.githubusercontent.com/e637f38e2f2a3df3baef805829027cd4a96bf272a887ec665472f6288a38107c/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f666173746e6f7274682f70726f70657274792d6d61707065722f6261646765732f6770612e737667)](https://codeclimate.com/github/fastnorth/property-mapper)

A common programming task deals with transforming data structures into one another, for instance for instance processing data from an API, or a database, into objects for internal usage. This library helps with creating mappers that can be:

- Reversed
- Written in isolation
- Composed
- Re-used
- Tested

Usage
-----

[](#usage)

Mapping operations are two-fold, first you define a `Map`, that defines which properties map to which, after which you can use the `Mapper` to apply it to two entities. This library uses [Symfony's PropertyAccess](http://symfony.com/doc/current/components/property_access/index.html)component internally to read and write from the given entities, so they can be both objects and arrays. The property notation follows PropertyAccess' notation.

### Creating A Map

[](#creating-a-map)

Creating a map is simply a matter of specifying all the properties on both sides of the map:

```
