This repository was archived by the owner on Mar 14, 2026. It is now read-only.
Repository navigation
DotArrayMapper 1.0.0
π What's new in 1.0.0
This is the first stable release of dot-array-mapper, a lightweight PHP library for mapping and transforming array data using dot notation.
β Features
- πΉ Extract specific values from deeply nested arrays using dot notation
- πΉ Define custom output keys mapped to source paths
- πΉ Clean API: set data, define mapping, extract result
- πΉ Fully analyzed and tested
- πΉ Compatible with PHP 8.3+
π¦ Installation
composer require kasperhansen/dot-array-mapperπ Basic usage
use Kasperhansen\DotArrayMapper;
$mapper = new DotArrayMapper();
// Set the data to be mapped
$mapper->setData([
'user' => [
'name' => 'John Doe',
'email' => 'john@doe.com',
'address' => [
'city' => 'New York',
],
],
]);
// Define the mapping using dot notation
$mapper->map([
'name' => 'user.name',
'email' => 'user.email',
'city' => 'user.address.city',
]);
// Extract the mapped data
$mappedData = $mapper->extract();
// Output the mapped data
echo $mappedData['name']; // John Doe
echo $mappedData['email']; // john@doe.com
echo $mappedData['city']; // New York