PHPackages                             luminovang/array-functions - 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. luminovang/array-functions

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

luminovang/array-functions
==========================

A backward utility function for array operations supported in PHP 8.1 and later.

1.0.0(1y ago)220MITPHPPHP &gt;=8.0

Since Dec 27Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Luminova Array Procedural Functions
===================================

[](#luminova-array-procedural-functions)

A lightweight utility package for array operations offering procedural functions like `array_find`, `array_all`, and more. These functions are already supported in PHP 8.1 and later. This package provide backward compatibility for PHP 8.0.

---

### Install via Composer

[](#install-via-composer)

Recommend installation method:

```
composer require luminovang/array-functions
```

### Include File

[](#include-file)

You can also use the function in another projects.

```
include_once __DIR__ . '/vendor/luminovang/array-functions/src/ArrayFuncs.php;';
```

---

### Importing the Functions

[](#importing-the-functions)

You can import multiple functions at once using the `use function` syntax with braces around the function names:

```
use function Luminova\Procedural\ArrayFunctions\{
   array_find,
   array_find_key,
   array_any,
   array_all
};
```

**Importing a Specific Function:**

To import a specific function, such as `array_find`, use the following syntax:

```
use function Luminova\Procedural\ArrayFunctions\array_find;
```

---

### Example Usage

[](#example-usage)

#### Finding an Element in an Array

[](#finding-an-element-in-an-array)

The `array_find` function allows you to find the first element in an array that satisfies a given condition specified in a callback.

```
$result = array_find([1, 2, 3, 4, 5], fn(int $value) => $value > 3);

echo $result; // Output: 4
```

> In this example, `array_find` returns the first element greater than 3, which is `4`.

---

#### Finding the Key of an Element in an Array

[](#finding-the-key-of-an-element-in-an-array)

The `array_find_key` function searches for the first key where the corresponding value meets the given condition.

```
$result = array_find_key(['apple', 'banana', 'cherry'], fn(string $value) => $value === 'banana');

echo $result; // Output: 1
```

> Here, `array_find_key` finds the key of 'banana', which is `1`.

**Another Example**

Find key using `str_starts_with`.

```
$result = array_find_key(
   ['java' => 1, 'php' => 2, 'swift' => 3],
   fn(int $value, string $key) => str_starts_with($key, 'p')
);

echo $result; // Output: php
```

> In this case, `array_find_key` returns the key `'php'`, where the key starts with `'p'`.

---

#### Checking If All Elements Meet a Condition

[](#checking-if-all-elements-meet-a-condition)

The `array_all` function checks if all elements in the array satisfy the condition defined in the callback.

```
$result = array_all([2, 4, 6], fn(int $value) => $value % 2 === 0);
echo $result; // Output: true
```

> In this example, `array_all` returns `true` because all elements in the array are even numbers.

---

#### Checking If Any Element Meets a Condition

[](#checking-if-any-element-meets-a-condition)

The `array_any` function checks if at least one element in the array meets the condition specified in the callback.

```
$result = array_any([1, 2, 3], fn(int $value) => $value > 2);
echo $result; // Output: true
```

> In this case, `array_any` returns `true` because one element (`3`) is greater than `2`.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

507d ago

### Community

Maintainers

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

---

Top Contributors

[![peterujah](https://avatars.githubusercontent.com/u/16369609?v=4)](https://github.com/peterujah "peterujah (15 commits)")

---

Tags

arraysluminovangphpphp8phparrayphp-8php-arrayarray-functionsluminovaphp luminova

### Embed Badge

![Health badge](/badges/luminovang-array-functions/health.svg)

```
[![Health](https://phpackages.com/badges/luminovang-array-functions/health.svg)](https://phpackages.com/packages/luminovang-array-functions)
```

###  Alternatives

[pharaonic/php-dot-array

Access array data quickly/easily using dot-notation and asterisk.

1011.6k3](/packages/pharaonic-php-dot-array)

PHPackages © 2026

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