PHPackages                             jnessier/data-handler - 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. jnessier/data-handler

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

jnessier/data-handler
=====================

Data container for arrays and more.

0.5.0(2y ago)06MITPHPPHP &gt;=8.1

Since Aug 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jnessier/DataHandler)[ Packagist](https://packagist.org/packages/jnessier/data-handler)[ RSS](/packages/jnessier-data-handler/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (4)Versions (10)Used By (0)

Data handler
============

[](#data-handler)

[![Build Status](https://github.com/jnessier/DataHandler/workflows/Tests/badge.svg)](https://github.com/jnessier/DataHandler/actions?query=branch:4.x)[![Latest Stable Version](https://camo.githubusercontent.com/aac0209b21b13dafc5fa3653166fda2dcde4b470cd6b3fdc43634d7a05bc032b/68747470733a2f2f706f7365722e707567782e6f72672f6a6e6573736965722f646174612d68616e646c65722f763f736572766963653d676974687562)](https://packagist.org/packages/jnessier/data-handler)[![Total Downloads](https://camo.githubusercontent.com/9916df5fd936f8e745786e60ad6e0b41af8c0f37a697d93f73bbe975a337b59f/68747470733a2f2f706f7365722e707567782e6f72672f6a6e6573736965722f646174612d68616e646c65722f646f776e6c6f6164733f736572766963653d676974687562)](https://packagist.org/packages/jnessier/data-handler)[![License](https://camo.githubusercontent.com/1dfd06d7959e023a6c7becf8dab4fc895cfc8da26d55642b200e0804d39ea492/68747470733a2f2f706f7365722e707567782e6f72672f6a6e6573736965722f646174612d68616e646c65722f6c6963656e73653f736572766963653d676974687562)](https://packagist.org/packages/jnessier/data-handler)

Data handler for PHP arrays.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirement](#requirement)
- [Installation](#installation)
- [Usage](#usage)
- [Limitations](#limitations)
- [Contributors](#contributors)
- [License](#license)

Requirement
-----------

[](#requirement)

- PHP &gt;= 8.1

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

[](#installation)

Install package of the data handler via Composer...

```
composer require jnessier/data-handler
```

...or manually download the latest release from [here](https://github.com/jnessier/DataHandler/releases/).

Usage
-----

[](#usage)

```
use DataHandler\Data;

// Create new data handler.
$data = new Data([
    // Array with key/value pairs
]);

// Get value by key.
$default = null; // Default value, when key doesn't exists
$value = $data->get('key', $default);

// Pull value by key and delete it afterward.
$default = null; // Default value, when key doesn't exists
$value = $data->pull('key', $default);

// Set value by key.
$overwrite = true; // Set FALSE to prevent overwrite existing value
$data = $data->set('key', 'value', $overwrite);

// Check whether value exists by key.
$valueExists = $data->has('key');

// Delete value by key.
$data->delete('key');

// Count number of values.
$numberOfValues = $data->count();

// Get all values as array.
$array = $data->getAll();

// Iterate trough values.
$data->each(function ($value, string $key) {
    // Callback for each key/value pair
});

// Clear values.
$data = $data->clear();

// Replace values. Existing values with similar keys will be overwritten.
$recursive = true; // Set FALSE to prevent recursive merge
$data = $data->replace([
    // Array with key/value pairs
], $recursive);

// Set array as values. Existing data will be overwritten.
$data = $data->setAll([
    // Array with key/value pairs
]);

// Set referenced array as values. Existing data will be overwritten.
$values = [
    // Array with key/value pairs
];
$data = $data->setAllReferenced($values);
```

Limitations
-----------

[](#limitations)

- Only string as key supported
- Only array as key/value pairs supported
- No dot notation implementation
- No type check for values

Contributors
------------

[](#contributors)

- Jonathan Nessier (jnessier)

If you would like to see this library develop further, or if you want to support me or show me your appreciation, please donate any amount through PayPal. Thank you! 🍻

[![Donate](https://camo.githubusercontent.com/80602243714763ba4467ec539f09f678d206cc112e76d358bf8970c5c90c2b7b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d70617970616c2d626c7565)](https://www.paypal.me/JonathanNessier)

License
-------

[](#license)

Licensed under [MIT](LICENSE).

*Made in Switzerland with 🧀 and ❤️*

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~141 days

Recently: every ~281 days

Total

9

Last Release

1032d ago

PHP version history (4 changes)0.0.1PHP ^7.3

0.3.0PHP &gt;=7.3

0.4.0PHP &gt;=8.0

0.5.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1c459ff75e7005e0042d27d315e2238e46c57d08a59eb467a12ceefb75e096f?d=identicon)[jnessier](/maintainers/jnessier)

---

Tags

datadata-handlerphp73

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jnessier-data-handler/health.svg)

```
[![Health](https://phpackages.com/badges/jnessier-data-handler/health.svg)](https://phpackages.com/packages/jnessier-data-handler)
```

###  Alternatives

[zaporylie/composer-drupal-optimizations

Composer plugin to improve composer performance for Drupal projects

14610.3M107](/packages/zaporylie-composer-drupal-optimizations)[pingpong/menus

Laravel Menus

70241.3k13](/packages/pingpong-menus)[mindkomm/theme-lib-mix

Laravel Mix functions for WordPress projects

3546.5k1](/packages/mindkomm-theme-lib-mix)

PHPackages © 2026

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