PHPackages                             backbrain/php-automapper - 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. backbrain/php-automapper

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

backbrain/php-automapper
========================

PHP port of the popular automapper.org library

v0.7.7(1mo ago)343.6k↑731.3%[16 PRs](https://github.com/BackBrainHQ/php-automapper/pulls)MITPHPPHP &gt;=8.4CI passing

Since Mar 24Pushed 2d ago1 watchersCompare

[ Source](https://github.com/BackBrainHQ/php-automapper)[ Packagist](https://packagist.org/packages/backbrain/php-automapper)[ Docs](https://backbrainhq.github.io/php-automapper/)[ RSS](/packages/backbrain-php-automapper/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (72)Versions (89)Used By (0)

PHP AutoMapper
==============

[](#php-automapper)

PHP AutoMapper is a library designed to simplify the mapping of data between objects, inspired by the popular .NET library AutoMapper. It aims to reduce boilerplate code necessary for transferring data from one object structure to another, making your PHP application cleaner and maintenance easier.

**Note:** This project is still in alpha development and may not yet support all features of the original AutoMapper library. Interfaces and methods may change even in minor releases until a stable version v1.x is reached.

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

[](#installation)

Use Composer to install PHP AutoMapper into your project:

```
composer require backbrain/php-automapper
```

Features
--------

[](#features)

PHP AutoMapper strives to implement the core functionalities of the original .NET AutoMapper library. Here's a list of supported features:

- Convention-based mapping
- Custom value resolvers
- Nested object mapping
- Conditional property mapping
- Custom value converters
- Before and after mapping actions
- Support for AutoMapper profiles
- Reverse mapping
- Inline mapping configuration
- Mapping to existing objects

Please note that due to differences between C# and PHP, not all features from the original AutoMapper library are applicable or have been implemented at this stage.

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

[](#documentation)

For a detailed documentation, please refer to the [PHP AutoMapper Documentation](https://backbrainhq.github.io/php-automapper) site.

Quick links:

- Getting Started:
- AutoMapper API:
- Error handling:
- Features:
- Extensibility:

For general usage patterns and understanding AutoMapper concepts, please refer to the original AutoMapper documentation:

[.NET AutoMapper Documentation](https://docs.automapper.org/en/latest/)

The concepts and configurations explained in the original documentation serve as a basis for understanding how to use PHP AutoMapper effectively. Where PHP AutoMapper diverges or extends the original library's functionality, specific documentation and examples will be provided within this project's wiki or documentation directory.

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

[](#usage-example)

Here's a simple example of how to use PHP AutoMapper to map data between two objects. For more examples and detailed usage instructions, please refer to the [examples](docs/example) directory.

```
