PHPackages                             daumling/php-dataset - 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. [Database &amp; ORM](/categories/database)
4. /
5. daumling/php-dataset

ActiveLibrary[Database &amp; ORM](/categories/database)

daumling/php-dataset
====================

A JSON-based, SQL-like manipulation of structured PHP data

1.0.2(6y ago)010MITPHPPHP &gt;=7.2.0

Since May 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/daumling/php-dataset)[ Packagist](https://packagist.org/packages/daumling/php-dataset)[ Docs](https://daumling.github.io/php-dataset/)[ RSS](/packages/daumling-php-dataset/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

php-datasets
============

[](#php-datasets)

**See the entire documentation at **!

I was looking for a simple way to manipulate complex PHP data structures. A quick research found a few solutions, which all fell short in some way.

The Dataset object takes an associative array, whose members are either arrays or objects. It provides SQL-like calls to search and manipulate data, and offers JSON files as a storage medium. Other storage solutions can be added easily with subclassing.

This Dataset implementation offers

- Easy handling of JSON data
- multiple search possibilities, including regular expressions
- hiding the differences between PHP arrays and objects
- multiple storage backends

Each search operation returns a new Dataset containing the results of the search only. The data of these child datasets is always stored by reference, which saves memory and makes updates easy. Of course, accidential updates may go unnoticed, so this concept needs to be used with caution.

Almost all Dataset methods return a Dataset instance, either a new dataset, or the dataset itself, so calls can be chained easily. Datasets containing intermediate results may be saved for later use.

Here is an example. Assuming a JSON database of persons with the following example record:

```
{
    "name" : "John Smith",
    "age": 44,
    "address" : {
        ...
        "state" : "CA"
    }
}
```

You can easily iterate over, say, retired persons with an age of 65 or more:

```
foreach ($file->where('age', '>=', 65)->fetch() as $record) ...
```

Or if you only need NY retirees:

```
foreach ($file->where('age', '>=', 65)->where('address.state' '=', 'NY')->fetch() as $record) ...
```

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

[](#installation)

The easiest way to install and use Datasets is `composer`:

`composer require daumling/php-dataset`

Your PHP file could look like this:

```
require_once __DIR__.'/vendor/autoload.php';
use \Daumling\Dataset\File as DB;

// set the path
DB::setOptions([
    'path' => __DIR__.'/data/*.json'
]);
// Open data/addresses.json
$file = DB::get('addresses');
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2251d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15716793?v=4)[Michael Daumling](/maintainers/daumling)[@daumling](https://github.com/daumling)

---

Tags

datasetjsonphpsqlphpjsonsqldatasetphp72

### Embed Badge

![Health badge](/badges/daumling-php-dataset/health.svg)

```
[![Health](https://phpackages.com/badges/daumling-php-dataset/health.svg)](https://phpackages.com/packages/daumling-php-dataset)
```

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[rolfvreijdenberger/izzum-statemachine

A superior statemachine library php &gt;= 5.3. Integrates with your domain models perfectly.

6426.1k](/packages/rolfvreijdenberger-izzum-statemachine)[friedolinfoerder/wp-activerecord

An ActiveRecord implementation for WordPress

237.8k](/packages/friedolinfoerder-wp-activerecord)

PHPackages © 2026

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