PHPackages                             aviator/array-map-keys - 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. aviator/array-map-keys

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

aviator/array-map-keys
======================

Array map with keys

0.1.0(8y ago)312.6k↑45%12MITPHPPHP &gt;=7.0.0

Since Nov 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/danielsdeboer/array-map-keys)[ Packagist](https://packagist.org/packages/aviator/array-map-keys)[ Docs](https://github.com/danielsdeboer/array-map-keys)[ RSS](/packages/aviator-array-map-keys/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/599599e61d499669955a0f5e7c49800bc869093fae097df683c896c8401f279a/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f61727261792d6d61702d6b6579732f762f737461626c65)](https://packagist.org/packages/aviator/array-map-keys)[![License](https://camo.githubusercontent.com/240bc667c234878b2d073aa4a9d6bcdfa880cded96ff0ac5602d63f73dd8467f/68747470733a2f2f706f7365722e707567782e6f72672f61766961746f722f61727261792d6d61702d6b6579732f6c6963656e7365)](https://packagist.org/packages/aviator/array-map-keys)[![Build Status](https://camo.githubusercontent.com/aceae10326209c3c36ba5a109fe8866f045a6c67cdf87e6c80891afb1996b3f8/68747470733a2f2f7472617669732d63692e6f72672f64616e69656c736465626f65722f61727261792d6d61702d6b6579732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danielsdeboer/array-map-keys)

Overview
--------

[](#overview)

PHP's `array_map()` function doesn't allow associative array key mutation. This package provides a function, `array_map_keys()`, which does.

The function iterates over an array and mutates each array item with the provided callback.

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

[](#installation)

Via Composer:

```
composer require aviator/array-map-keys

```

Testing
-------

[](#testing)

Via Composer:

```
composer test

```

Usage
-----

[](#usage)

An array:

```
$input = [
    [
        'company' => 'Aviator Creative',
        'owner' => 'Daniel Deboer',
        'email' => 'daniel.s.deboer@gmail.com',
    ],
    [
        'company' => 'Widget Makers',
        'owner' => 'Jane Doe',
        'email' => 'jane@widgets.com',
    ],
];
```

A callback:

```
$callback = function ($key, $value) {
    return [
        $value['owner'] => $value['email'];
    ];
};
```

The `array_map_keys` function:

```
$results = array_map_keys($input, $callback);
```

The output:

```
echo $results;

/*
[
    'Daniel Deboer' => 'daniel.s.deboer@gmail.com',
    'Jane Doe' => 'jane@widgets.com',
]
*/
```

Other Stuff
-----------

[](#other-stuff)

### License

[](#license)

This package is licensed with the [MIT License (MIT)](LICENSE.md).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3096d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebd3fe214b5768e700ae43c7fdc4b83d249972a6a97a0faef372d0ec19256eca?d=identicon)[danielsdeboer](/maintainers/danielsdeboer)

---

Top Contributors

[![danielsdeboer](https://avatars.githubusercontent.com/u/13170241?v=4)](https://github.com/danielsdeboer "danielsdeboer (3 commits)")

---

Tags

arrayskeysmapphpphp7phpmapfunctionalarraysPHP7

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aviator-array-map-keys/health.svg)

```
[![Health](https://phpackages.com/badges/aviator-array-map-keys/health.svg)](https://phpackages.com/packages/aviator-array-map-keys)
```

###  Alternatives

[lambdish/phunctional

λ PHP functional library

3612.0M23](/packages/lambdish-phunctional)[mpetrovich/dash

A functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.

10428.9k1](/packages/mpetrovich-dash)[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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