PHPackages                             rodrigodornelles/php-array-lib - 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. rodrigodornelles/php-array-lib

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

rodrigodornelles/php-array-lib
==============================

simple libary for functional programing paradigm with arrays

1.0.0(4y ago)1131[8 issues](https://github.com/RodrigoDornelles/php-array-lib/issues)BSD-3-ClausePHPPHP ~5.4.0|~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0|~7.3.0|~7.4.0|~8.0.0|~8.1.0|~8.2.0

Since Apr 17Pushed 4y ago2 watchersCompare

[ Source](https://github.com/RodrigoDornelles/php-array-lib)[ Packagist](https://packagist.org/packages/rodrigodornelles/php-array-lib)[ RSS](/packages/rodrigodornelles-php-array-lib/feed)WikiDiscussions master Synced 1w ago

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

rodrigodornelles/php-array-lib
==============================

[](#rodrigodornellesphp-array-lib)

[![version](https://camo.githubusercontent.com/5ed41b2ff5a74d49750d1a6afc98fb44cd3b833cb84ff06b683809a13e03567a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f726f647269676f646f726e656c6c65732f7068702d61727261792d6c69623f736f72743d73656d766572266c6f676f3d7061636b6167697374)](https://packagist.org/packages/rodrigodornelles/php-array-lib)[![license](https://camo.githubusercontent.com/58be2383c36c4eaee52c45b06739f74af6a932277296321a429d4fc8e99d7d0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f647269676f646f726e656c6c65732f7068702d61727261792d6c6962)](https://github.com/RodrigoDornelles/php-array-lib/blob/master/LICENSE)[![quality](https://camo.githubusercontent.com/1ca52cb7f0160140823c6b496d60d70c77e37e07b8701405b71eb91018f2cd7a/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f35616331383562633563623434333339616338646332656539386538303832643f6c6f676f3d636f64616379)](https://www.codacy.com/gh/RodrigoDornelles/php-array-lib/dashboard?utm_source=github.com&utm_medium=referral&utm_content=RodrigoDornelles/php-array-lib&utm_campaign=Badge_Grade)[![coverage](https://camo.githubusercontent.com/fa7151e790ef69eda461464e3d372755d6b998475383443aaf911d072e63bdc5/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f636f7665726167652f35616331383562633563623434333339616338646332656539386538303832643f6c6f676f3d636f64616379)](https://www.codacy.com/gh/RodrigoDornelles/php-array-lib/dashboard?utm_source=github.com&utm_medium=referral&utm_content=RodrigoDornelles/php-array-lib&utm_campaign=Badge_Coverage)[![building](https://camo.githubusercontent.com/db973fd817b7fd82f73aab6288beab9e0ed36b89be243e8619537fffdea89d68/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636865636b732d7374617475732f726f647269676f646f726e656c6c65732f7068702d61727261792d6c69622f6d61737465723f6c6f676f3d676974687562)](https://github.com/rodrigodornelles/php-array-lib/actions)

> simple libary for functional programing paradigm with arrays

Features
--------

[](#features)

- Test driven development style *(TDD)*
- PHP version compatibility **5.4** at **8.2**
- Make your code cleaner and more readable
- Adds new methods to manipulate arrays *(Inspired by **ruby**, **js** and other langs)*

How to Use
----------

[](#how-to-use)

```
use ArrayCreate;                                  # if you using namespaces

$myNewArray = ArrayCreate::from($myOriginalArray) # instantiate pipeline class
  ->map(someItemFunction)                         # first function to iterate on each item
  ->map(anotherItemFunction)                      # next function to iterate on each item
  ->filter(anotherItemFunction2)                  # next function to filter on each item
  ->construct();                                  # returns new array
```

Examples
--------

[](#examples)

### side by side comparison

[](#side-by-side-comparison)

Make an algorithm that sorts an array, removes the numbers not divisible by 3, and shows the result of each multiplied by 2 and separated by commas.

Libary
FunctionalNative
FunctionalStructured[![libary functional example](/images/libary-functional-min.png)](./examples/readme-functional-libary.php)[![native functional example](/images/native-functional-min.png)](./examples/readme-functional-native.php)[![structured example](/images/structured-min.png)](./examples/readme-structured.php)Installation
------------

[](#installation)

### With Composer

[](#with-composer)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require rodrigodornelles/php-array-lib "~1.0.0"
```

or add

```
"rodrigodornelles/php-array-lib": "~1.0.0"
```

to the `require` section of your `composer.json` file.

### Without Composer

[](#without-composer)

#### Step 1

[](#step-1)

Download libary in

#### Step 2

[](#step-2)

Extract the file into your libraries folder

#### Step 3

[](#step-3)

Import the main class

```
