PHPackages                             webfactory/content-mapping - 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. [Framework](/categories/framework)
4. /
5. webfactory/content-mapping

ActiveLibrary[Framework](/categories/framework)

webfactory/content-mapping
==========================

Mini framework for mapping content from a source to a destination system, e.g. from Propel objects to Solr or from Doctrine entities to ElasticSearch.

3.8.0(7mo ago)414.6k↓61.5%4MITPHPPHP &gt;= 8.1CI passing

Since Mar 21Pushed 2w ago8 watchersCompare

[ Source](https://github.com/webfactory/content-mapping)[ Packagist](https://packagist.org/packages/webfactory/content-mapping)[ RSS](/packages/webfactory-content-mapping/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (2)Versions (27)Used By (4)

`content-mapping`
=================

[](#content-mapping)

`content-mapping` is a mini framework for mapping content from a source to a destination system. E.g. from Propel objects to Solr, from Doctrine entities to ElasticSearch or from one XML structure to another. It features interfaces to guide you on your mapping way and ships with some abstract implementation helpers or magic implementations.

In easy situations, you may want to consider other libraries instead. E.g. if in a Symfony2 project you want to index Doctrine entities in a Solr server, you may want to consider the great [floriansemm/solr-bundle](/floriansemm/SolrBundle). But that and other libraries have shortcomings in more complex situation, e.g. when you want to index attributes of related entities. That's why we present you content-mapping with a more general approach.

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

[](#installation)

Add the content-mapping dependency by running the command (see ):

```
php composer.phar require webfactory/content-mapping

```

and run

```
php composer.phar install

```

Concept
-------

[](#concept)

[![Class diagram](doc/class-diagram.png)](doc/class-diagram.png)

The content-mapping process is based on four parts: the `Synchronizer`, a `SourceAdapter`, a `Mapper` and a `DestinationAdapter`. The entry point is `Synchronizer->synchronize()`: there, the Synchronizer gets an Iterator from the `SourceAdapter->getObjectsOrderedById()` as well as an Iterator from the `DestinationAdapter->getObjectsOrderedById()`, and compares the objects in each one. During the comparison, it deletes outdated objects (`DestinationAdapter->delete()`), stores a new objects (`DestinationAdapter->createObject()`) and updates existing objects in the destination system (`Mapper->map()`).

`DestinationAdapter->updated()` and `DestinationAdapter->commit()` are only hooks for external change tracking, to say an object has been updated or both Iterators have been processed, i.e. changes can be persisted.

Usage
-----

[](#usage)

To construct a `Synchronizer`, you need implementations for the `SourceAdaper`, `Mapper` and `DestinationAdapter`. Please find abstract templates and ready-to-use generic implementations of SourceAdapters and DestinationAdapters in the [webfactory/content-mapping-\*](https://github.com/search?q=webfactory%2Fcontent-mapping)packages. The Mapper usually is very specific for your project, so you probably want to implement it in your application.

```
use Webfactory\ContentMapping\Synchronizer;
use Webfactory\ContentMapping\SourceAdapter\Propel\GenericPropelSourceAdapter;

$sourceAdapter = ...; // see the readme of the corresponding package on how to construct it
$mapper = ...; // construct your own implementation
$destinationAdapter = ...; // see the readme of the corresponding package on how to construct it
$logger = ...; // just a PSR-3 logger

$classNameToSynchronize = 'MyClass';
$force = false; // if true, objects in destination system will be updated even if no changes are detected

$synchronizer = new Synchronizer($sourceAdapter, $mapper, $destinationAdapter, $logger);
$synchronizer->synchronize($classNameToSynchronize, $force);
```

Credits, Copyright and License
------------------------------

[](#credits-copyright-and-license)

This project was started at webfactory GmbH, Bonn.

-

Copyright 2015-2025 webfactory GmbH, Bonn. Code released under [the MIT license](LICENSE).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance82

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 56.4% 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 ~208 days

Recently: every ~313 days

Total

25

Last Release

227d ago

Major Versions

1.0.7 → 2.0.02015-07-31

2.0.0 → 3.0.02015-08-10

1.x-dev → 2.x-dev2015-11-30

2.0.1 → 3.1.02016-05-19

PHP version history (6 changes)2.0.0PHP &gt;=5.3.0

3.2.0PHP &gt;=5.5.0

3.3.0PHP &gt;=7.1

3.5.0PHP ^7.2|8.0.\*|8.1.\*

3.6.0PHP ^7.2|8.0.\*|8.1.\*|8.2.\*|8.3.\*

3.8.0PHP &gt;= 8.1

### Community

Maintainers

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

---

Top Contributors

[![MalteWunsch](https://avatars.githubusercontent.com/u/2504942?v=4)](https://github.com/MalteWunsch "MalteWunsch (53 commits)")[![mpdude](https://avatars.githubusercontent.com/u/1202333?v=4)](https://github.com/mpdude "mpdude (37 commits)")[![relthyg](https://avatars.githubusercontent.com/u/8628559?v=4)](https://github.com/relthyg "relthyg (3 commits)")[![FabianSchmick](https://avatars.githubusercontent.com/u/17527958?v=4)](https://github.com/FabianSchmick "FabianSchmick (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/webfactory-content-mapping/health.svg)

```
[![Health](https://phpackages.com/badges/webfactory-content-mapping/health.svg)](https://phpackages.com/packages/webfactory-content-mapping)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M419](/packages/drupal-core-recommended)

PHPackages © 2026

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