PHPackages                             dsheiko/extras - 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. dsheiko/extras

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

dsheiko/extras
==============

Chainable, high-order utility functions for PHP arrays, strings, numbers, functions and collections — inspired by JavaScript and Underscore.js

v1.0.4(1mo ago)84.1k↓55.7%3MITPHPPHP &gt;=7.0.0CI failing

Since Apr 11Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/dsheiko/extras)[ Packagist](https://packagist.org/packages/dsheiko/extras)[ Docs](https://github.com/dsheiko/extras)[ RSS](/packages/dsheiko-extras/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (12)Versions (5)Used By (0)

[![Dsheiko\Extras](./wiki/extras-promo.svg)](./wiki/extras-promo.svg)

Dsheiko\\Extras
===============

[](#dsheikoextras)

[![Latest Stable Version](https://camo.githubusercontent.com/bd766abb9496de738f606d9a1b160a8c79f7dd26957e8952916387391547cf11/68747470733a2f2f706f7365722e707567782e6f72672f64736865696b6f2f6578747261732f762f737461626c65)](https://packagist.org/packages/dsheiko/extras)[![Total Downloads](https://camo.githubusercontent.com/8b1e0844784250ee95162d9a0590826b6ec069c28e857011ca58a42f8201cecd/68747470733a2f2f706f7365722e707567782e6f72672f64736865696b6f2f6578747261732f646f776e6c6f616473)](https://packagist.org/packages/dsheiko/extras)[![License](https://camo.githubusercontent.com/8b1db52a665dd2628e03ff1275c57550b75cd12e171bd7a21215deaed74ed2a1/68747470733a2f2f706f7365722e707567782e6f72672f64736865696b6f2f6578747261732f6c6963656e7365)](https://packagist.org/packages/dsheiko/extras)

JavaScript-style utility methods for PHP. Chainable `map`, `filter`, `reduce`, and dozens more — consistent naming, predictable argument order, and a familiar API inspired by [Underscore.js](http://underscorejs.org/) and [Lodash](https://lodash.com/).

> The name comes from "Array Extras" — the array methods added in ES5 that made JavaScript array manipulation practical.

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

[](#installation)

```
composer require "dsheiko/extras"
```

Highlights
----------

[](#highlights)

- **Consistent naming** — all methods use `camelCase` instead of PHP's mixed `lower_case` conventions
- **Consistent argument order** — target value always comes first: `Arrays::method($target, ...$options)`
- **Chainable interface** — `Any::chain($value)->map(...)->filter(...)->value()`
- **PlainObject** — a JavaScript-style plain object with dot-access and chainable methods
- **Native performance** — built on PHP's own functions; no `foreach` where a built-in can do the job
- **Familiar API** — methods match JavaScript, Underscore.js, and Lodash where possible

Utility Sets
------------

[](#utility-sets)

SetTypes covered[Arrays](./wiki/ARRAYS.md)PHP arrays[Collections](./wiki/COLLECTIONS.md)Iterable, ArrayObject, Iterator[Strings](./wiki/STRINGS.md)PHP strings[Numbers](./wiki/NUMBERS.md)Integer, Double, NaN[Booleans](./wiki/BOOLEANS.md)PHP booleans[Functions](./wiki/FUNCTIONS.md)PHP callables[Plain Object](./wiki/PLAIN-OBJECT.md)stdClass-like objects[Any](./wiki/ANY.md)Any PHP type[Chaining](./wiki/CHAINING.md)Fluent chain API[Utilities](./wiki/UTILITIES.md)Standalone helpersDownload
--------

[](#download)

[Dsheiko\\Extras Cheatsheet (PDF)](https://raw.githubusercontent.com/dsheiko/extras/master/wiki/cheatsheet-extras.pdf)

Architecture
------------

[](#architecture)

[![Overview](./wiki/extras-overview.png)](./wiki/extras-overview.png)

Examples
--------

[](#examples)

### Static method call

[](#static-method-call)

```
