DataMapper API
Complete API reference for DataMapper.
Static Methods
Section titled “Static Methods”source(array $source): self
Section titled “source(array $source): self”Set source data.
$mapper = DataMapper::source($sourceData);target(array $target): self
Section titled “target(array $target): self”Set target data.
$mapper = DataMapper::source($src)->target($tgt);Mapping Methods
Section titled “Mapping Methods”template(array $template): self
Section titled “template(array $template): self”Set mapping template.
$mapper->template([ 'name' => '{{ user.full_name }}', 'email' => '{{ user.email }}',]);map(): self
Section titled “map(): self”Execute mapping.
$mapper->map();getTarget(): array
Section titled “getTarget(): array”Get mapped target.
$result = $mapper->getTarget();Configuration Methods
Section titled “Configuration Methods”skipNull(bool $skip = true): self
Section titled “skipNull(bool $skip = true): self”Skip null values.
$mapper->skipNull(true);reindexWildcard(bool $reindex = true): self
Section titled “reindexWildcard(bool $reindex = true): self”Reindex wildcard results.
$mapper->reindexWildcard(false);hooks(array $hooks): self
Section titled “hooks(array $hooks): self”Set hooks.
$mapper->hooks($hooksArray);Template Syntax
Section titled “Template Syntax”Simple Path
Section titled “Simple Path”'{{ source.path }}'With Default
Section titled “With Default”'{{ source.path | default:"N/A" }}'With Filters
Section titled “With Filters”'{{ source.path | upper | trim }}'Wildcards
Section titled “Wildcards”'{{ users.*.name }}'See Also
Section titled “See Also”- DataMapper Guide - Complete guide
- Hooks & Events - Hooks guide