PHPackages                             cleup/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. cleup/arr

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

cleup/arr
=========

Convenient extension of array handling functionality

1.2.0(1y ago)0862MITPHPPHP &gt;=8.1

Since Aug 22Pushed 1y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (2)

Cleup - Working with arrays
===========================

[](#cleup---working-with-arrays)

#### Installation

[](#installation)

Install the `cleup/arr` library using composer:

```
composer require cleup/arr

```

#### Usage

[](#usage)

##### Dot syntax methods

[](#dot-syntax-methods)

```
use Cleup\Helpers\Arr;

// Initial array
$array = array(
    'name'  => 'Edward',
    'data' => [
        'age' => 21,
        'gender' => 'male'
    ]
);

# Sets the value by overwriting all items
Arr::set('name', 'Jimmy', $array);
Arr::set('data.age', 18, $array);
Arr::set('data.tasks', [
    'Read the book',
    'Go to a restaurant'
], $array);
/*
[
  "name" => "Jimmy",
  "data" => [
    "age" => 18,
    "gender" => "male",
    "tasks" => [
      0 => "Read the book",
      1 => "Go to a restaurant"
    ]
  ]
]
*/

# Replaces the old value with the new one without overwriting the whole array or its fragment
Arr::replace('data', [
    'age' => 30,
], $array);
/*
...
  "data" => [
    "age" => 30,
    ...
...
*/

# Adds a new element to the end of the array
Arr::append('data.tasks', 'Feeding the cat', $array);
/*
...
    "tasks" => [
      0 => "Read the book",
      1 => "Go to a restaurant",
      2 => "Feeding the cat"
    ]
...
*/

# Adds a new element to the beginning of the array
Arr::prepend('data.tasks', 'Watch a movie', $array);
/*
...
    "tasks" => [
      0 => "Watch a movie",
      1 => "Read the book",
      2 => "Go to a restaurant",
      3 => "Feeding the cat"
    ]
...
*/

# Deletes a value from the array
Arr::delete('data.gender', $array);
/*
...
  "data" => [
    "age" => 30,
    "tasks" => [
      0 => "Read the book",
      1 => "Go to a restaurant"
...
*/

# Recursively get the value of the array
Arr::get('name', $array); // Jimmy
Arr::get('data.tasks.0', $array); // Watch a movie
Arr::get('data.tasks', $array);
/*
[
    0 => "Watch a movie",
    1 => "Read the book",
    2 => "Go to a restaurant",
    3 => "Feeding the cat"
]
*/

# Does the array contain the specified key
Arr::has('data.tasks.1', $array); // true
Arr::has('data.work', $array); // false
```

##### Default methods

[](#default-methods)

```
# Determines if an array is associative.
$assoc = array(
    'name'  => 'Edward',
    'gender' => 'male'
);
$list = ['Apple', 'Orange'];

Arr::isAssoc($assoc); // true
Arr::isAssoc($list);  // false

# Determines whether the array is a list.
Arr::isList($list);  // true
Arr::isList($assoc); // false

# Matching for each of the array elements.
$newAssoc = Arr::map($assoc, function($value, $key) {
    return strtoupper($value);
});
/*
[
    'name'  => 'EDWARD',
    'gender' => 'MALE'
];
*/

# Convert the array into a query string.
$result =  Arr::query($assoc); // "name=Edward&gender=male"

# Divide the array into keys and values.
[$keys, $values] = Arr::divide($assoc);
/*
    $keys = [
        0 => 'name',
        1 => 'gender'
    ];
    $values = [
        0 => "Edward"
        1 => "male"
    ];
*/

# Join all items using a string.
Arr::join($list, ','); // "Apple,Orange,Cherry"
Arr::join($list, ', ', ' or '); // "Apple, Orange or Cherry"

# Retrieve only the required elements from the specified array.
Arr:only($assoc, 'gender') // ['gender' => 'male']
Arr:only($assoc, [
    'name',
    'gender'
]) // ['name' => 'Edward', gender' => 'male']
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance42

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~149 days

Total

2

Last Release

483d ago

### Community

Maintainers

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

---

Top Contributors

[![priveted](https://avatars.githubusercontent.com/u/18353516?v=4)](https://github.com/priveted "priveted (3 commits)")[![cleup](https://avatars.githubusercontent.com/u/156127069?v=4)](https://github.com/cleup "cleup (2 commits)")

---

Tags

phparrayarr

### Embed Badge

![Health badge](/badges/cleup-arr/health.svg)

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

###  Alternatives

[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)

PHPackages © 2026

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