unknownrori/easyarray

This package is abandoned and no longer maintained. No replacement package was suggested.

A wrapper class that manipulate array easy to read while still lightweight and fast

1.0 2022-02-25 02:55 UTC

This package is auto-updated.

Last update: 2022-06-26 09:35:46 UTC


README

Overview

\UnknownRori\EasyArray\EasyArray is a lightweight helper class that can make your array manipulation logic readable.

Feature

  • find
  • last
  • length
  • get
  • key
  • isNull
  • pop
  • map
  • split
  • remove
  • push
  • merge
  • mergeRecursive
  • fill
  • filter
  • reverse
  • unique
  • exist
  • insertKey
  • insertVal
  • limit
  • save

Installation

Composer require unknownrori/easyarray

Usage

Creating new Collection

$array = new EasyArray([1, 2, 3])

Map the collection

$article = new EasyArray([
    "article" => "Lorem ipsum",
    "slug" => "Lorem",
    "timestamp" => date_timestamp_get(date_create()),
]);

$article->map(function ($name) {
    return strtoupper($name);
});

$modifiedArticle = $article->getData();

or using helper function

$array = EasyArr([1, 2, 3]);