PHPackages                             twelver313/rich-array - 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. twelver313/rich-array

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

twelver313/rich-array
=====================

Improved array constructor with additional methods

v1.0.0-beta(1y ago)02MITPHPPHP &gt;=7.2

Since Oct 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mansurhamidov14/rich-array)[ Packagist](https://packagist.org/packages/twelver313/rich-array)[ RSS](/packages/twelver313-rich-array/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

RichArray
=========

[](#richarray)

**RichArray** is a PHP library designed to bring the flexibility and familiarity of JavaScript's array methods to PHP. It allows developers, especially those coming from JavaScript, to work with arrays in PHP using methods like `forEach`, `filter`, `find`, and more—all.

Features
--------

[](#features)

- Access elements using array-like syntax (e.g., `$richArray[0]`)
- JavaScript-style methods like `forEach`, `filter`, `find`, and more
- Fully compatible with PHP's array access and `foreach` loops
- Easily extensible for additional custom methods

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

[](#installation)

You can install the package via Composer:

```
composer require twelver313/rich-array
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

Here’s how you can use **RichArray** to make your PHP arrays behave more like JavaScript arrays:

```
