PHPackages                             qaadee/php-array-indexer - 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. qaadee/php-array-indexer

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

qaadee/php-array-indexer
========================

Tiny PHP functions for indexing and grouping arrays and iterables by custom keys.

v0.1.0(3w ago)01MITPHPPHP ^8.1

Since May 17Pushed 3w agoCompare

[ Source](https://github.com/QaaDee/php-array-indexer)[ Packagist](https://packagist.org/packages/qaadee/php-array-indexer)[ Docs](https://github.com/QaaDee/php-array-indexer)[ RSS](/packages/qaadee-php-array-indexer/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

PHP Array Indexer
=================

[](#php-array-indexer)

Tiny PHP functions for indexing and grouping arrays and iterables by custom keys.

The package is intentionally small:

- no framework dependency;
- no service container;
- no classes required;
- works with arrays, objects, Doctrine entities, DTOs, generators and any iterable.

Useful when you receive a list of objects from a database and want fast access by `id`, `uuid`, `slug`, `email`, `externalId`, or any other calculated key.

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

[](#installation)

After the package is published on Packagist:

```
composer require qaadee/php-array-indexer
```

Before publishing on Packagist, you can install it directly from GitHub:

```
composer config repositories.php-array-indexer vcs https://github.com/QaaDee/php-array-indexer
composer require qaadee/php-array-indexer:dev-main
```

Requirements
------------

[](#requirements)

```
PHP 8.1+

```

Functions
---------

[](#functions)

```
QaaDee\PhpArrayIndexer\index_by()
QaaDee\PhpArrayIndexer\index_by_unique()
QaaDee\PhpArrayIndexer\group_by()
```

Basic usage
-----------

[](#basic-usage)

```
