PHPackages                             p810/array-fl - 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. p810/array-fl

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

p810/array-fl
=============

Provides a consolidated polyfill for array\_key\_first(), array\_key\_last(), and the unapproved functions array\_value\_first() and array\_value\_last().

1.2.0(7y ago)1991MITPHP

Since Jul 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/p810/array-fl)[ Packagist](https://packagist.org/packages/p810/array-fl)[ RSS](/packages/p810-array-fl/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (6)Used By (1)

array-fl
========

[](#array-fl)

> Provides a consolidated polyfill for `array_key_first()`, `array_key_last()`, and the unapproved functions `array_value_first()` and `array_value_last()`.

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

[](#installation)

This package is available via Packagist:

```
composer require p810/array-fl

```

You can also download it directly from GitHub. Latest stable tag: [1.2.0](https://github.com/p810/array-fl/archive/1.2.0.zip)

API
---

[](#api)

#### `array_first(array $array): null|array`

[](#array_firstarray-array-nullarray)

Returns a tuple containing the key and value of the first item in `$array`. If `$array` is not an array or is empty, `null` is returned.

#### `array_last(array $array): null|array`

[](#array_lastarray-array-nullarray)

Returns a tuple containing the key and value of the last item in `$array`. If `$array` is not an array or is empty, `null` is returned.

#### `array_key_first(array $array): null|int|string`

[](#array_key_firstarray-array-nullintstring)

Returns the key of the first item in `$array`. If `$array` is not an array or is empty, `null` is returned.

#### `array_key_last(array $array): null|int|string`

[](#array_key_lastarray-array-nullintstring)

Returns the key of the last item in `$array`. If `$array` is not an array or is empty, `null` is returned.

#### `array_value_first(array $array): null|mixed`

[](#array_value_firstarray-array-nullmixed)

Returns the value of the first item in `$array`. If `$array` is not an array or is empty, `null` is returned.

#### `array_value_last(array $array): null|mixed`

[](#array_value_lastarray-array-nullmixed)

Returns the value of the last item in `$array`. If `$array` is not an array or is empty, `null` is returned.

Tests
-----

[](#tests)

Run `composer run test` to run a set of unit tests for these functions. No external dependency (e.g. PHPUnit) is required.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Total

5

Last Release

2592d ago

### Community

Maintainers

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

---

Top Contributors

[![p810](https://avatars.githubusercontent.com/u/3998736?v=4)](https://github.com/p810 "p810 (16 commits)")

### Embed Badge

![Health badge](/badges/p810-array-fl/health.svg)

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

###  Alternatives

[dsawardekar/wp-requirements

Library for handling minimum system requirements in WordPress Plugins

122.1k1](/packages/dsawardekar-wp-requirements)[lcinhk/flarum-ext-acgembed

Add acfun.cn and bilibili.com in mediaembed

161.2k](/packages/lcinhk-flarum-ext-acgembed)

PHPackages © 2026

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