PHPackages                             fanboykun/datamining - 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. fanboykun/datamining

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

fanboykun/datamining
====================

data mining calculation in PHP

01PHP

Since Aug 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/fanboykun/datamining)[ Packagist](https://packagist.org/packages/fanboykun/datamining)[ RSS](/packages/fanboykun-datamining/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Data Mining Method Calculation On PHP
=====================================

[](#data-mining-method-calculation-on-php)

[![Total Downloads](https://camo.githubusercontent.com/116f5d1f0f734b921e6b04e10dd67d21f41a4766bf6ac3323ae677ee0ba82903/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66616e626f796b756e2f646174616d696e696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fanboykun/datamining)

This package provide calculation of datamining Algorithm, Current Algorithm that can be used is KMeans, C45 on working.

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

[](#installation)

You can install the package via composer:

```
composer require fanboykun/datamining
```

Usage
-----

[](#usage)

Use the class

```
use Fanboykun\Datamining\Datamining
```

### In this example, we going to use KMeans

[](#in-this-example-we-going-to-use-kmeans)

example of the data go give

```
$points = Study::all()->map(function ($study, $k) {
        return [
            'key' => $study->student_id,
            'val' => [
            $study->matematika,
            $study->fisika,
            $study->kimia,
            $study->biologi,
            $study->sejarah,
            $study->akuntansi,
            $study->sosiologi,
            $study->geografi,
            ],
        ];
    })->toArray();
```

use one of the available method, init the custructor

```
// example, we use KMeans, init with desired space (data example above)
$space = (new Datamining)->initKMeans(8)
```

add all point into space

```
// give the array of the data as the point to insert into space as the first parameter
// give the key of the points(data to calculate) as the second parameter
// give to value of the data to calculate as the third parameter
 $space->addAllPointToSpace($points, 'key', 'val');
```

execute the calulation

```
// the required arguments are :

// the number of the cluster you want to set
// int $numberOfCluster

// the initialization method (set to 3 for set the first centroid manually)
// $initMethod = 1

// give the index of the array of the points you want set as the first centroid
// $selectedPoints = []
$dataset = $space->solveWithIterationCallback(2, 3, [0,1]);
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [fanboykun](https://github.com/fanboykun)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1df1886e94a49c42daff30f145b2c2906975e2b9a87da4006162b5a6241bfe4d?d=identicon)[fanboykun](/maintainers/fanboykun)

---

Top Contributors

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

---

Tags

clustering-algorithmdataminingkmeans

### Embed Badge

![Health badge](/badges/fanboykun-datamining/health.svg)

```
[![Health](https://phpackages.com/badges/fanboykun-datamining/health.svg)](https://phpackages.com/packages/fanboykun-datamining)
```

###  Alternatives

[laravel-frontend-presets/material-dashboard

Laravel 11.x Front-end preset for material

264283.7k](/packages/laravel-frontend-presets-material-dashboard)

PHPackages © 2026

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