Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 8 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ 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

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

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

## 📚 Modules

Expand All @@ -39,8 +35,6 @@ real-world PHP projects.
| **DotNotation** | Get/set/remove values using dot keys; flatten & expand nested arrays with dot keys. |
| **BaseArrayHelper** | Internal shared base for consistent API across helpers. |

---

### ➤ Config System

| Class | Description |
Expand All @@ -49,7 +43,6 @@ real-world PHP projects.
| **DynamicConfig** | Extends `Config` with **on-get/on-set hooks** to transform values dynamically (e.g., encrypt/decrypt, auto-format). |
| **BaseConfigTrait** | Shared config logic. |

---

### ➤ Collections

Expand All @@ -60,7 +53,6 @@ real-world PHP projects.
| **Pipeline** | Functional-style pipeline for chaining operations on collections. |
| **BaseCollectionTrait** | Shared collection behavior. |

---

### ➤ Traits

Expand All @@ -69,30 +61,25 @@ real-world PHP projects.
| **HookTrait** | Generic hook system for on-get/on-set callbacks. Used by `DynamicConfig` & `HookedCollection`. |
| **DTOTrait** | Utility trait for DTO-like behavior: populate, extract, cast arrays/objects easily. |

---

### ➤ Global Helpers

| File | Description |
|-------------------|------------------------------------------------------------|
| **functions.php** | Global shortcut functions for frequent array/config tasks. |

---

## ✅ Requirements

* **PHP 8.2** or higher

---

## ⚡ Installation

```bash
composer require infocyph/arraykit
```

---

## 🚀 Quick Examples

### 🔹 Single-Dimensional Helpers
Expand All @@ -112,8 +99,6 @@ $dupes = ArraySingle::duplicates($list); // [2]
$page = ArraySingle::paginate($list, page:1, perPage:2); // [1, 2]
```

---

### 🔹 Multi-Dimensional Helpers

```php
Expand All @@ -134,8 +119,6 @@ $depth = ArrayMulti::depth($data); // 3
$sorted = ArrayMulti::sortRecursive($data);
```

---

### 🔹 Dot Notation

```php
Expand All @@ -156,8 +139,6 @@ $flat = DotNotation::flatten($user);
// [ 'profile.name' => 'Alice', 'profile.email' => '[email protected]' ]
```

---

### 🔹 Dynamic Config with Hooks

```php
Expand All @@ -179,8 +160,6 @@ $config->set('auth.password', 'secret123');
$hashed = $config->get('auth.password');
```

---

### 🔹 Hooked Collection

```php
Expand All @@ -200,8 +179,6 @@ $collection['role'] = 'admin';
echo $collection['role']; // Role: admin
```

---

### 🔹 DTO Trait Example

```php
Expand All @@ -219,14 +196,10 @@ $user->fromArray(['name' => 'Alice', 'email' => '[email protected]']);
$array = $user->toArray();
```

---

## 🤝 Support

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

---

## 📄 License

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