PHPackages                             abmmhasan/bucket - 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. abmmhasan/bucket

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

abmmhasan/bucket
================

A Collection of useful PHP array functions.

3.0(1mo ago)5116MITPHPPHP &gt;=8.3CI passing

Since Jan 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/infocyph/ArrayKit)[ Packagist](https://packagist.org/packages/abmmhasan/bucket)[ RSS](/packages/abmmhasan-bucket/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (12)Versions (10)Used By (0)

ArrayKit
========

[](#arraykit)

[![Security & Standards](https://github.com/infocyph/arraykit/actions/workflows/build.yml/badge.svg)](https://github.com/infocyph/arraykit/actions/workflows/build.yml)[![Codacy Badge](https://camo.githubusercontent.com/31eb5ac2a4e542b64f4ae66925dd382669f9c063d2ff71b0ccfb554975302ec8/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3935356365376662313035663432343361303138653730316637366562663434)](https://app.codacy.com/gh/infocyph/ArrayKit/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![Packagist Downloads](https://camo.githubusercontent.com/97f5f3a99e21cd38f2755a954d883c77de3d6675b78b933d8af45354252d7646/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e666f637970682f61727261796b69743f636f6c6f723d677265656e266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246696e666f6379706825324661727261796b6974)](https://camo.githubusercontent.com/97f5f3a99e21cd38f2755a954d883c77de3d6675b78b933d8af45354252d7646/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e666f637970682f61727261796b69743f636f6c6f723d677265656e266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246696e666f6379706825324661727261796b6974)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![Packagist Version](https://camo.githubusercontent.com/24f1cb0889f0ea795863b0203bec7402ac5d1fb83867159d55de06c9cb9fb16b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e666f637970682f61727261796b6974)](https://camo.githubusercontent.com/24f1cb0889f0ea795863b0203bec7402ac5d1fb83867159d55de06c9cb9fb16b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e666f637970682f61727261796b6974)[![Packagist PHP Version](https://camo.githubusercontent.com/f494ebdcb791e95a738cee153faef26f3db6b0ef3ab2248f3cca68e000fdfad5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696e666f637970682f61727261796b69742f706870)](https://camo.githubusercontent.com/f494ebdcb791e95a738cee153faef26f3db6b0ef3ab2248f3cca68e000fdfad5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696e666f637970682f61727261796b69742f706870)[![GitHub Code Size](https://camo.githubusercontent.com/a5846950d7692ace4f11d776cb6b45021ca9891eedb5e376167a1d0ab77995ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f696e666f637970682f61727261796b6974)](https://camo.githubusercontent.com/a5846950d7692ace4f11d776cb6b45021ca9891eedb5e376167a1d0ab77995ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f696e666f637970682f61727261796b6974)[![Documentation](https://camo.githubusercontent.com/8531f182cf5b2da3fc7cdb341b710a4b1e7cb279b19e471abd9c975f44866866/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f63756d656e746174696f6e2d41727261794b69742d626c75653f6c6f676f3d72656164746865646f6373266c6f676f436f6c6f723d7768697465)](https://docs.infocyph.com/projects/arraykit/)

**ArrayKit** is a modern **PHP 8.4+** library for elegant, high-performance **array manipulation**, **dot notation utilities**, **dynamic configuration**, **hookable collections**, and more. From shallow single arrays to deeply nested data structures — **ArrayKit** provides a fluent, reliable toolkit for real-world PHP projects.

📦 Features at a Glance
----------------------

[](#-features-at-a-glance)

- **Single-Dimensional Helpers**
- **Multi-Dimensional Helpers**
- **Dot Notation Get/Set/Flatten**
- **Dynamic Config with Hooks**
- **Collection &amp; Hooked Collection**
- **Traits for DTO &amp; Hooking**
- **Pipeline for Collection Ops**
- **Global Helpers (`functions.php`)**

📚 Modules
---------

[](#-modules)

### ➤ Array Helpers

[](#-array-helpers)

HelperDescription**ArraySingle**Helpers for single-dimensional arrays (detect list/assoc, filter, paginate, duplicates, averages).**ArrayMulti**Helpers for multi-dimensional arrays (flatten, collapse, depth, recursive sort, filter).**DotNotation**Get/set/remove values using dot keys; flatten &amp; expand nested arrays with dot keys.**BaseArrayHelper**Internal shared base for consistent API across helpers.### ➤ Config System

[](#-config-system)

ClassDescription**Config**Dot-access configuration loader.**DynamicConfig**Extends `Config` with **on-get/on-set hooks** to transform values dynamically (e.g., encrypt/decrypt, auto-format).**BaseConfigTrait**Shared config logic.### ➤ Collections

[](#-collections)

ClassDescription**Collection**OOP array wrapper implementing `ArrayAccess`, `Iterator`, `Countable`, `JsonSerializable`.**HookedCollection**Extends `Collection` with **on-get/on-set hooks** for real-time transformation of values.**Pipeline**Functional-style pipeline for chaining operations on collections.**BaseCollectionTrait**Shared collection behavior.### ➤ Traits

[](#-traits)

TraitDescription**HookTrait**Generic hook system for on-get/on-set callbacks. Used by `DynamicConfig` &amp; `HookedCollection`.**DTOTrait**Utility trait for DTO-like behavior: populate, extract, cast arrays/objects easily.### ➤ Global Helpers

[](#-global-helpers)

FileDescription**functions.php**Global shortcut functions for frequent array/config tasks.✅ Requirements
--------------

[](#-requirements)

- **PHP 8.4** or higher

⚡ Installation
--------------

[](#-installation)

```
composer require infocyph/arraykit
```

🚀 Quick Examples
----------------

[](#-quick-examples)

### 🔹 Single-Dimensional Helpers

[](#-single-dimensional-helpers)

```
use Infocyph\ArrayKit\Array\ArraySingle;

$list = [1, 2, 3, 2];

// Is it a list?
$isList = ArraySingle::isList($list); // true

// Duplicates
$dupes = ArraySingle::duplicates($list); // [2]

// Pagination
$page = ArraySingle::paginate($list, page:1, perPage:2); // [1, 2]
```

### 🔹 Multi-Dimensional Helpers

[](#-multi-dimensional-helpers)

```
use Infocyph\ArrayKit\Array\ArrayMulti;

$data = [ [1, 2], [3, [4, 5]] ];

// Flatten to one level
$flat = ArrayMulti::flatten($data); // [1, 2, 3, 4, 5]

// Collapse one level
$collapsed = ArrayMulti::collapse($data); // [1, 2, 3, [4, 5]]

// Nesting depth
$depth = ArrayMulti::depth($data); // 3

// Recursive sort
$sorted = ArrayMulti::sortRecursive($data);
```

### 🔹 Dot Notation

[](#-dot-notation)

```
use Infocyph\ArrayKit\Array\DotNotation;

$user = [
    'profile' => ['name' => 'Alice']
];

// Get value
$name = DotNotation::get($user, 'profile.name'); // Alice

// Set value
DotNotation::set($user, 'profile.email', 'alice@example.com');

// Flatten
$flat = DotNotation::flatten($user);
// [ 'profile.name' => 'Alice', 'profile.email' => 'alice@example.com' ]
```

### 🔹 Dynamic Config with Hooks

[](#-dynamic-config-with-hooks)

```
use Infocyph\ArrayKit\Config\DynamicConfig;

$config = new DynamicConfig();

// Load from file
$config->loadFile(__DIR__.'/config.php');

// Hook: auto-hash password when set
$config->onSet('auth.password', fn($v) => password_hash($v, PASSWORD_BCRYPT));

// Hook: decrypt when getting 'secure.key'
$config->onGet('secure.key', fn($v) => decrypt($v));

// Use it
$config->set('auth.password', 'secret123');
$hashed = $config->get('auth.password');
```

### 🔹 Hooked Collection

[](#-hooked-collection)

```
use Infocyph\ArrayKit\Collection\HookedCollection;

$collection = new HookedCollection(['name' => 'alice']);

// Hook on-get: uppercase
$collection->onGet('name', fn($v) => strtoupper($v));

// Hook on-set: prefix
$collection->onSet('role', fn($v) => "Role: $v");

echo $collection['name']; // ALICE

$collection['role'] = 'admin';
echo $collection['role']; // Role: admin
```

### 🔹 DTO Trait Example

[](#-dto-trait-example)

```
use Infocyph\ArrayKit\traits\DTOTrait;

class UserDTO {
    use DTOTrait;

    public string $name;
    public string $email;
}

$user = new UserDTO();
$user->fromArray(['name' => 'Alice', 'email' => 'alice@example.com']);
$array = $user->toArray();
```

🤝 Support
---------

[](#-support)

Have a bug or feature idea? Please [open an issue](https://github.com/infocyph/arraykit/issues).

📄 License
---------

[](#-license)

Licensed under the **MIT License** — use it freely for personal or commercial projects. See [LICENSE](LICENSE) for details.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance99

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~61 days

Recently: every ~99 days

Total

8

Last Release

35d ago

Major Versions

1.0 → 2.02025-02-25

2.03.2 → 3.02026-04-04

PHP version history (2 changes)1.0PHP &gt;=8.2

3.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/33b750b84ab22f2038ef9b90ee48f2fcdaab6b5698e9f956a89a152466200b63?d=identicon)[abmmhasan](/maintainers/abmmhasan)

---

Top Contributors

[![abmmhasan](https://avatars.githubusercontent.com/u/7711128?v=4)](https://github.com/abmmhasan "abmmhasan (62 commits)")

---

Tags

arrayconfigcollection

###  Code Quality

TestsPest

Static AnalysisPsalm, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/abmmhasan-bucket/health.svg)

```
[![Health](https://phpackages.com/badges/abmmhasan-bucket/health.svg)](https://phpackages.com/packages/abmmhasan-bucket)
```

###  Alternatives

[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[yansongda/supports

common components

211.4M31](/packages/yansongda-supports)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)[armincms/json

A Laravel Nova field.

25149.4k3](/packages/armincms-json)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
