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. [Utility &amp; Helpers](/categories/utility)
4. /
5. thominj/data-miner

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

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

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

v1.0.0(11y ago)0301MITPHPPHP &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 3w ago

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 41% 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

4337d ago

Major Versions

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3819908?v=4)[James Thomin](/maintainers/thominj)[@thominj](https://github.com/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.

4.0k390.0M4.5k](/packages/fakerphp-faker)[dflydev/dot-access-data

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

722393.7M108](/packages/dflydev-dot-access-data)[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.6M52](/packages/markrogoyski-math-php)[wnx/laravel-stats

Get insights about your Laravel Project

1.7k1.8M7](/packages/wnx-laravel-stats)[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2179.4M25](/packages/mbezhanov-faker-provider-collection)[php-units-of-measure/php-units-of-measure

A PHP library for converting between standard units of measure.

3143.8M36](/packages/php-units-of-measure-php-units-of-measure)

PHPackages © 2026

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