PHPackages                             thominj/data-miner - 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. thominj/data-miner

ActiveLibrary

thominj/data-miner
==================

A set of tools for common data mining operations in PHP.

v1.0.0(11y ago)1301MITPHPPHP &gt;=5.4.0

Since Aug 17Pushed 11y ago1 watchersCompare

[ Source](https://github.com/thominj/DataMiner)[ Packagist](https://packagist.org/packages/thominj/data-miner)[ RSS](/packages/thominj-data-miner/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

\#DataMiner

Data Miner is a set of data mining tools written in PHP. It is designed for easy integration with existing websites.

\##Installation

You can install Data Miner very easily with [Composer](https://getcomposer.org/).

Include this in your composer.json file's require section:

```
"require": {
        "thominj/data-miner": "1.*"
    }

```

Then run:

```
composer install

```

Finally, include the composer autoload file in your project:

```
require_once(PATH_TO_VENDOR_DIR.'/autoload.php');
```

\##Histogram

Histograms bin data by counting the number of times a value occurs within a given range. The bin ranges are given by an array where each value corresponds to the left endpoint (inclusive) of the range. The last value is the right end point of the last bin.

For example:

```
$bins = [ 0, 1, 2, 3];
$data = [ -1, 0, 0.5, 1, 3, 4 ];

$histogram = new thominj\DataMiner\Histogram($bins, $data);
$result = $histogram->getResult();

print_r($result);
```

This will output:

```
Array
(
    [less] => 1
    [0] => 2
    [1] => 1
    [2] => 0
    [3] => 2
)

```

The last bin labeled '3' contains all values greater than or equal to 3.

\###Setting Bins and Adding Data

You can set the bins and add data in lots of different ways. Each of these will give the same result:

```
// Set bins and add data in the constructor
$histogram = new thominj\DataMiner\Histogram($bins, $data);

// Set bins in the constructor, add data later
$histogram = new thominj\DataMiner\Histogram($bins);
$histogram->addData($data);

// Set bins and add data after instancing the histogram
$histogram = new thominj\DataMiner\Histogram();
$histogram->setBins($bins);
$histogram->addData($data);
```

\###Online Mode

You can also run in online mode to repeatedly add data sets. Histogram will sort the data as it comes in, accumulating the results and letting you check them whenever you like:

```
// Online mode
$histogram = new thominj\DataMiner\Histogram($bins);

// Add some data
$histogram->addData($data);

// Get the result
print_r($histogram->getResult());

// Add some more data
$histogram->addData($data);

// Get the new result
print_r($histogram->getResult());
```

This will give:

```
Array
(
    [less] => 1
    [0] => 2
    [1] => 1
    [2] => 0
    [3] => 2
)
Array
(
    [less] => 2
    [0] => 4
    [1] => 2
    [2] => 0
    [3] => 4
)

```

\###Save and Resume

You can even save a set of results, then pre-load it before adding more data. This lets you save results in the middle of a long process, re-load them, and pick up where you left off.

```
$old_result = array(
  'less' => 2,
  0 => 4,
  1 => 2,
  2 => 0,
  3 => 4
);

$histogram = new thominj\DataMiner\Histogram();
$histogram->preload($old_result);
$histogram->addData($data);

print_r($histogram->getResult());
```

This outputs:

```
Array
(
    [less] => 3
    [0] => 6
    [1] => 3
    [2] => 0
    [3] => 6
)

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

4284d ago

Major Versions

0.0.1.x-dev → v1.0.02014-08-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/04f05b12b54877f6fd51bd1dbca9f7519c3c59e3add42a49115455017114e89f?d=identicon)[thominj](/maintainers/thominj)

---

Top Contributors

[![thominj](https://avatars.githubusercontent.com/u/3819908?v=4)](https://github.com/thominj "thominj (27 commits)")

---

Tags

datastatistics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thominj-data-miner/health.svg)

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

###  Alternatives

[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k358.5M3.5k](/packages/fakerphp-faker)[nelmio/alice

Expressive fixtures generator

2.5k43.4M133](/packages/nelmio-alice)[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

718359.1M86](/packages/dflydev-dot-access-data)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M301](/packages/doctrine-mongodb-odm)[theofidry/alice-data-fixtures

Nelmio alice extension to persist the loaded fixtures.

32528.5M70](/packages/theofidry-alice-data-fixtures)[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2138.6M24](/packages/mbezhanov-faker-provider-collection)

PHPackages © 2026

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