PHPackages                             polyfills/array-first-array-last - 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. polyfills/array-first-array-last

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

polyfills/array-first-array-last
================================

PHP: Provides a user-land polyfill for `array\_first` and `array\_last` functions added in PHP 8.5.

v1.0.1(1y ago)35.5k↓31.7%2MITPHPPHP ^7.3 || ^8.0CI passing

Since Apr 23Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/PHP-Polyfills/array-first-array-last)[ Packagist](https://packagist.org/packages/polyfills/array-first-array-last)[ Docs](https://php.watch/versions/8.5/array_first-array_last)[ RSS](/packages/polyfills-array-first-array-last/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

`array_first` and `array_last` polyfills
========================================

[](#array_first-and-array_last-polyfills)

[![Latest Stable Version](https://camo.githubusercontent.com/35bf7ec33d0c6a4266c655754db8787854314373c10590a95579e5cf311cb611/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f61727261792d66697273742d61727261792d6c6173742f76)](https://packagist.org/packages/polyfills/array-first-array-last) [![License](https://camo.githubusercontent.com/7dbabfaaa07415ada1ea3594bd8332a533bff0e932319dd035ecb642b928ba61/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f61727261792d66697273742d61727261792d6c6173742f6c6963656e7365)](https://packagist.org/packages/polyfills/array-first-array-last) [![PHP Version Require](https://camo.githubusercontent.com/dd5d644a4ff868fe927d3f7d4107a14dd0a506507ed8d117d44320c620fe7bc3/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f61727261792d66697273742d61727261792d6c6173742f726571756972652f706870)](https://packagist.org/packages/polyfills/array-first-array-last)

Provides user-land PHP polyfills for the `array_first` and `array_last` functions added in PHP 8.5.

Requires PHP 7.3 or later. Not supported on PHP 8.5 because these functions are natively implemented in PHP 8.5.

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

[](#installation)

```
composer require polyfills/array-first-array-last
```

Usage
-----

[](#usage)

Simply use the `array_first` and `array_last` functions as if they were declared already.

Contributions
-------------

[](#contributions)

Contributions are welcome either as a GitHub issue or a PR to this repo.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance51

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

2

Last Release

389d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1703f88c1f225e3fadff28458e81328f86668d9631a8c489f45ea1aaebe12df2?d=identicon)[Ayesh](/maintainers/Ayesh)

---

Top Contributors

[![Ayesh](https://avatars.githubusercontent.com/u/811553?v=4)](https://github.com/Ayesh "Ayesh (2 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![miclf](https://avatars.githubusercontent.com/u/3188746?v=4)](https://github.com/miclf "miclf (1 commits)")

---

Tags

compatibilitypolyfillshimpolyfillscompatphp85phpwatch

### Embed Badge

![Health badge](/badges/polyfills-array-first-array-last/health.svg)

```
[![Health](https://phpackages.com/badges/polyfills-array-first-array-last/health.svg)](https://phpackages.com/packages/polyfills-array-first-array-last)
```

###  Alternatives

[symfony/polyfill-mbstring

Symfony polyfill for the Mbstring extension

7.8k1.2B515](/packages/symfony-polyfill-mbstring)[symfony/polyfill-php72

Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions

4.8k674.7M31](/packages/symfony-polyfill-php72)[symfony/polyfill-util

Symfony utilities for portability of PHP codes

1.3k123.9M7](/packages/symfony-polyfill-util)[symfony/polyfill-intl-idn

Symfony polyfill for intl's idn\_to\_ascii and idn\_to\_utf8 functions

3.4k774.6M90](/packages/symfony-polyfill-intl-idn)[symfony/polyfill-intl-normalizer

Symfony polyfill for intl's Normalizer class and related functions

2.1k830.2M36](/packages/symfony-polyfill-intl-normalizer)[symfony/polyfill-php73

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

2.4k581.8M67](/packages/symfony-polyfill-php73)

PHPackages © 2026

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