PHPackages                             czproject/arrays - 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. czproject/arrays

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

czproject/arrays
================

Array tools library.

v1.2.0(1y ago)01241BSD-3-ClausePHPPHP 8.0 - 8.4CI passing

Since Aug 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/czproject/arrays)[ Packagist](https://packagist.org/packages/czproject/arrays)[ Fund](https://www.janpecha.cz/donate/)[ RSS](/packages/czproject-arrays/feed)WikiDiscussions master Synced 4w ago

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

CzProject\\Arrays
=================

[](#czprojectarrays)

[![Build Status](https://github.com/czproject/arrays/workflows/Build/badge.svg)](https://github.com/czproject/arrays/actions)[![Downloads this Month](https://camo.githubusercontent.com/1842e53ccf44c645d08d9be0633004c21634bc44f845d4a38a17bf245fa5b929/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f637a70726f6a6563742f6172726179732e737667)](https://packagist.org/packages/czproject/arrays)[![Latest Stable Version](https://camo.githubusercontent.com/6b9aa346c2ed13bc0972447f648cc6abaa718e7ea528fb7fe0f4cd7a0f11aaf0/68747470733a2f2f706f7365722e707567782e6f72672f637a70726f6a6563742f6172726179732f762f737461626c65)](https://github.com/czproject/arrays/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/czproject/arrays/blob/master/license.md)

Array tools library.

[![Donate](https://camo.githubusercontent.com/101b981194f1dafbf9c42e19c3034fe2d724e75be972cef0f4477074997834db/68747470733a2f2f6275796d65636f666665652e696e746d2e6f72672f696d672f646f6e6174652d62616e6e65722e76312e737667)](https://www.janpecha.cz/donate/)

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

[](#installation)

[Download a latest package](https://github.com/czproject/arrays/releases) or use [Composer](http://getcomposer.org/):

```
composer require czproject/arrays

```

`CzProject\Arrays` requires PHP 8.0 or later.

Usage
-----

[](#usage)

```
use CzProject\Arrays;
```

### `flatten()`

[](#flatten)

```
$data = Arrays::flatten(array(
	'value 1',
	'values' => array(
		'value 2-1',
		'value 2-2',
		'value 2-3',
	),
	'value 3',
));

/* Returns:
[
	'value 1',
	'value 2-1',
	'value 2-2',
	'value 2-3',
	'value 3',
]
*/
```

### `fetchPairs()`

[](#fetchpairs)

```
$rows = array(
	array(
		'id' => 1,
		'name' => 'Row #1',
	),

	array(
		'id' => 2,
		'name' => 'Row #2',
	),

	array(
		'id' => 3,
		'name' => 'Row #3',
	),
);

$data = Arrays::fetchPairs($rows, 'id', 'name');

/* Returns:
[
	1 => 'Row #1',
	2 => 'Row #2',
	3 => 'Row #3',
]
*/
```

### `merge()`

[](#merge)

```
$defaultConfig = array(
	'parameters' => array(
		'database' => array(
			'host' => 'localhost',
			'database' => 'lorem_ipsum',
			'driver' => 'mysql',
		),
	),

	'messages' => array(
		'success' => 'Success!',
		'error' => 'Error!',
	),
);

$config = array(
	'parameters' => array(
		'database' => array(
			'user' => 'user123',
			'password' => 'password123',
		),
	),

	'messages' => array(
		'error' => 'Fatal Error!',
	),
);

$data = Arrays::merge($config, $defaultConfig);

/* Returns:
[
	parameters => [
		database => [
			host => 'localhost',
			database => 'lorem_ipsum',
			driver => 'mysql',
			user => 'user123',
			password => 'password123',
		]
	],

	messages => [
		success => 'Success!',
		error => 'Fatal Error!',
	]
]
*/
```

### `pushFrom()`

[](#pushfrom)

```
$a = ['A1', 'A2', 'A3', 'A4'];
$b = ['B1', 'B2'];
$result = [];

for ($i = 0; $i < 4; $i++) {
	Arrays::pushFrom($result, $a);
	Arrays::pushFrom($result, $b);
}

/* Returns:
[
	'A1',
	'B1',
	'A2',
	'B2',
	'A3',
	'A4',
]
*/
```

---

License: [New BSD License](license.md)
Author: Jan Pecha,

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance48

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 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 ~1608 days

Total

3

Last Release

385d ago

PHP version history (3 changes)v1.0.0PHP &gt;=5.4.0

v1.1.0PHP &gt;=5.6.0

v1.2.0PHP 8.0 - 8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c980b1511b4a0350442dc23d89c99d4d9a2411b7e765d52c133ccacf616968b?d=identicon)[janpecha](/maintainers/janpecha)

---

Top Contributors

[![janpecha](https://avatars.githubusercontent.com/u/637719?v=4)](https://github.com/janpecha "janpecha (26 commits)")

---

Tags

arraysphp

### Embed Badge

![Health badge](/badges/czproject-arrays/health.svg)

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

PHPackages © 2026

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