PHPackages                             zero-to-prod/arr - 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. zero-to-prod/arr

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

zero-to-prod/arr
================

Array helpers.

v1.2.0(1y ago)110.0k↓16.7%3MITPHPPHP &gt;=7.1CI passing

Since Feb 4Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/arr)[ Packagist](https://packagist.org/packages/zero-to-prod/arr)[ Docs](https://github.com/zero-to-prod/arr)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-arr/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (3)

Zerotoprod\\Arr
===============

[](#zerotoprodarr)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/arr)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/0968ddb528accb2d34d05f7aabb54551280796ce8a1f33a60e49c1d800dc8df6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f6172722f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/arr/actions)[![Packagist Downloads](https://camo.githubusercontent.com/4d26f5ce715a3fd77958c43986974129eff06673197c0c23fa591c16db1b5f09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f6172723f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/arr/stats)[![php](https://camo.githubusercontent.com/9232a4f0d2b13ccd675ee72a25bc6e8df38b0a12ae0c7fde40b4bf9597e3b7ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f6172722e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/arr/stats)[![Packagist Version](https://camo.githubusercontent.com/cae33344540d51fdffdac3fa0275d160b3db3adec4d0bc948e46df19f8b50c37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f6172723f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/arr)[![License](https://camo.githubusercontent.com/fc5e68782ae3a0442968e0538228d73af9f2464e2ea3fcd05662c9ea6acc8d17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f6172723f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/arr/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/8171c41f9e02068c00c648140e0d4ca1dcbde52049763a5d71e789301575f739/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f6172722e737667)](https://wakatime.com/badge/github/zero-to-prod/arr)[![Hits-of-Code](https://camo.githubusercontent.com/a671bd010b16908b7c45e41b01f11b165e6e1856d67a54b3c7c680df7c8f4fbd/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f6172723f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/arr/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [mapKeys()](#mapkeys)
    - [set()](#set)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

Array helpers.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

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

[](#installation)

Install `Zerotoprod\Arr` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/arr
```

This will add the package to your project’s dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/arr)
vendor/bin/zero-to-prod-arr

# Publish to custom directory
vendor/bin/zero-to-prod-arr /path/to/your/docs
```

#### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
  "scripts": {
    "post-install-cmd": [
      "zero-to-prod-arr"
    ],
    "post-update-cmd": [
      "zero-to-prod-arr"
    ]
  }
}
```

Usage
-----

[](#usage)

### mapKeys()

[](#mapkeys)

Map keys of an array like this:

```
$array = [
    'Key1' => [
        'Key2' => 1
    ]
];

$new_array = Arr::mapKeys($array, function (string $key) {
    return strtolower($key);
});

$key2 = $new_array['key1']['key2']);
```

### set()

[](#set)

Set values in arrays using dot notation, merge arrays, or use callbacks:

```
// Set value with dot notation
$array = ['a' => ['b' => 1]];
$new_array = Arr::set($array, 'a.b', 2); // ['a' => ['b' => 2]]

// Merge arrays
$array1 = ['a' => 1];
$array2 = ['b' => 2];
$new_array = Arr::set($array1, $array2); // ['a' => 1, 'b' => 2]

// Use a callback
$array = ['a' => 1];
$new_array = Arr::set($array, function($array) {
    $array['b'] = 2;
    return $array;
}); // ['a' => 1, 'b' => 2]

// Empty string key does not modify the array
$array = ['a' => 1];
$new_array = Arr::set($array, ''); // ['a' => 1]
```

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/arr/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance52

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87% 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 ~0 days

Total

5

Last Release

469d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (20 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

arrzero-to-prod

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-arr/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-arr/health.svg)](https://phpackages.com/packages/zero-to-prod-arr)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14226.2k32](/packages/zero-to-prod-data-model)[pragmarx/ia-arr

Laravel Illuminate Agnostic Arr

553.6M12](/packages/pragmarx-ia-arr)

PHPackages © 2026

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