Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

DotArrayMapper 1.0.0

Choose a tag to compare

@kasperh90 kasperh90 released this 07 Aug 10:35
· 1 commit to main since this release

πŸš€ 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