PHPackages                             pecee/dot-notation - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pecee/dot-notation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pecee/dot-notation
==================

Dot notation support for JSON-like syntax for easily creating and mapping arrays in PHP.

2.2.0(8y ago)230MITPHPPHP &gt;=5.4.0

Since Mar 15Pushed 8y ago3 watchersCompare

[ Source](https://github.com/skipperbent/dot-notation)[ Packagist](https://packagist.org/packages/pecee/dot-notation)[ Docs](https://github.com/skipperbent/dot-notation)[ RSS](/packages/pecee-dot-notation/feed)WikiDiscussions v2-release Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

pecee/dot-notation
==================

[](#peceedot-notation)

Dot notation support for JSON-like syntax for easily creating and mapping arrays in PHP.

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

[](#installation)

Run the following command in terminal to add the latest version of pecee/dot-notation library to your project.

```
composer require pecee/dot-notation

```

Examples
--------

[](#examples)

This example returns an array from a basic dot formatted string, similar to the JSON syntax:

```
$d = new \Pecee\DotNotation(['one' => ['two' => 2]]);
$d->set('one.two', 3);
echo $d->getValues();
```

**Output:**

```
array ('one' => ['two' => 3]);
```

### Easily map one array to another

[](#easily-map-one-array-to-another)

```
class CustomerMapper {

    protected $customer;

    public function __construct(array $values) {

        // Map fields (from -> to)

        $this->customer = $this->map($values, [
            'customerId' => 'id',
            'relationshipStatus' => 'relationship_status',
            'customerGender' => 'gender',
            'meta.name' => 'name',
        ]);
    }

    protected function map(array $input, array $mapping) {
        $output = array();

        foreach($mapping as $before => $after) {

            $map = new DotNotation($input);
            $value = $map->get($before);

            $map = new DotNotation($output);
            $map->set($after, $value);
            $output = $map->getValues();
        }

        return $output;
    }

    protected function getCustomer() {
        return $this->customer;
    }
}

// Example:

$mapper = new CustomerMapper([
    'customerId' => 123456,
    'relationshipStatus' => 'single',
    'customerGender' => 'male',
    'meta' => ['name' => 'Peter']
]);

$customer = $mapper->getCustomer();
```

**Output:**

```
array(
    'id' => 123456,
    'relationship_status' => 'single',
    'gender' => 'male',
    'name' => 'Peter',
);
```

### Credits

[](#credits)

elfet

The MIT License (MIT)
---------------------

[](#the-mit-license-mit)

Copyright (c) 2016 Simon Sessingø / pecee

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~321 days

Total

3

Last Release

3071d ago

PHP version history (2 changes)2.0PHP &gt;=5.3.0

2.2.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dab716ac4ac16ea3e01400efe43853b43821b33b8c601c2c772689d58cebf3c?d=identicon)[sessingo](/maintainers/sessingo)

---

Top Contributors

[![skipperbent](https://avatars.githubusercontent.com/u/634762?v=4)](https://github.com/skipperbent "skipperbent (10 commits)")

---

Tags

phpjsonarraysyntaxmappingmultidimensionalarray-convertmove-array-key

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pecee-dot-notation/health.svg)

```
[![Health](https://phpackages.com/badges/pecee-dot-notation/health.svg)](https://phpackages.com/packages/pecee-dot-notation)
```

###  Alternatives

[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)[hi-folks/data-block

Data class for managing nested arrays and JSON data.

1472.2k](/packages/hi-folks-data-block)

PHPackages © 2026

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