Skip to content

DataMapper API

Complete API reference for DataMapper.

Set source data.

$mapper = DataMapper::source($sourceData);

Set target data.

$mapper = DataMapper::source($src)->target($tgt);

Set mapping template.

$mapper->template([
'name' => '{{ user.full_name }}',
'email' => '{{ user.email }}',
]);

Execute mapping.

$mapper->map();

Get mapped target.

$result = $mapper->getTarget();

Skip null values.

$mapper->skipNull(true);

reindexWildcard(bool $reindex = true): self

Section titled “reindexWildcard(bool $reindex = true): self”

Reindex wildcard results.

$mapper->reindexWildcard(false);

Set hooks.

$mapper->hooks($hooksArray);
'{{ source.path }}'
'{{ source.path | default:"N/A" }}'
'{{ source.path | upper | trim }}'
'{{ users.*.name }}'