PHPackages                             qazdcc/php-ml - 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. qazdcc/php-ml

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

qazdcc/php-ml
=============

PHP-ML - Machine Learning library for PHP

0.5.0(8y ago)024[1 PRs](https://github.com/qazdcc/php-ml/pulls)MITPHPPHP ^7.1

Since Jul 7Pushed 8y agoCompare

[ Source](https://github.com/qazdcc/php-ml)[ Packagist](https://packagist.org/packages/qazdcc/php-ml)[ Docs](https://github.com/php-ai/php-ml)[ RSS](/packages/qazdcc-php-ml/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

PHP-ML - Machine Learning library for PHP
=========================================

[](#php-ml---machine-learning-library-for-php)

[![Minimum PHP Version](https://camo.githubusercontent.com/824c5c4ccb56537db3b3b53bb43d7b8edc6286f3b3d1705525e0821dfd22d27e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e737667)](https://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/e22dd29f73bf361e53b3f6e7a04fe6a6d9d63eb6e1aace085e042bf0af6c4a90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d61692f7068702d6d6c2e737667)](https://packagist.org/packages/php-ai/php-ml)[![Build Status](https://camo.githubusercontent.com/3c6051b0b346163999083959313415bacb0e97b6ff5199d3dff6a05e2590883a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068702d61692f7068702d6d6c2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/php-ai/php-ml/build-status/master)[![Documentation Status](https://camo.githubusercontent.com/f5dba9d7890a5374a8e29ef9d6b9c20ea697f3ae1e7fd30be43a5e0b678d4aa1/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f7068702d6d6c2f62616467652f3f76657273696f6e3d6d6173746572)](http://php-ml.readthedocs.org/)[![Total Downloads](https://camo.githubusercontent.com/5520b32bf7f297eff12f576b02e8f42b90fb18475c758e400cd473af81c9746a/68747470733a2f2f706f7365722e707567782e6f72672f7068702d61692f7068702d6d6c2f646f776e6c6f6164732e737667)](https://packagist.org/packages/php-ai/php-ml)[![License](https://camo.githubusercontent.com/976b950a432a2a11bad43aaab3afc222b6d27eaf53f8ab507f1c104c6e47c0d6/68747470733a2f2f706f7365722e707567782e6f72672f7068702d61692f7068702d6d6c2f6c6963656e73652e737667)](https://packagist.org/packages/php-ai/php-ml)[![Coverage Status](https://camo.githubusercontent.com/a121bed90812549b27093eba5dc3d34d233158247a415a83857d14677312baac/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7068702d61692f7068702d6d6c2f62616467652e7376673f6272616e63683d636f766572616c6c73)](https://coveralls.io/github/php-ai/php-ml?branch=coveralls)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8424e75e0589ec2b0f68a2dcdaa098b40bb9a4d4dc2f471cd54543d833a1b546/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068702d61692f7068702d6d6c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/php-ai/php-ml/?branch=master)

[ ![](https://camo.githubusercontent.com/14bf7a93b88b218bad3fe7203139bc06df9f4a64b12cca157aade2596a37867e/687474703a2f2f7777772e7965676f723235362e636f6d2f696d616765732f61776172642f323031372f77696e6e65722d69746372616674736d616e706c2e706e67)](http://www.yegor256.com/2016/10/23/award-2017.html)[![PHP-ML - Machine Learning library for PHP](docs/assets/php-ml-logo.png)](docs/assets/php-ml-logo.png)

Fresh approach to Machine Learning in PHP. Algorithms, Cross Validation, Neural Network, Preprocessing, Feature Extraction and much more in one library.

PHP-ML requires PHP &gt;= 7.0.

Simple example of classification:

```
require_once __DIR__ . '/vendor/autoload.php';

use Phpml\Classification\KNearestNeighbors;

$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
$labels = ['a', 'a', 'a', 'b', 'b', 'b'];

$classifier = new KNearestNeighbors();
$classifier->train($samples, $labels);

echo $classifier->predict([3, 2]);
// return 'b'
```

Documentation
-------------

[](#documentation)

To find out how to use PHP-ML follow [Documentation](http://php-ml.readthedocs.org/).

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

[](#installation)

Currently this library is in the process of being developed, but You can install it with Composer:

```
composer require php-ai/php-ml

```

Examples
--------

[](#examples)

Example scripts are available in a separate repository [php-ai/php-ml-examples](https://github.com/php-ai/php-ml-examples).

Features
--------

[](#features)

- Association rule learning
    - [Apriori](http://php-ml.readthedocs.io/en/latest/machine-learning/association/apriori/)
- Classification
    - [SVC](http://php-ml.readthedocs.io/en/latest/machine-learning/classification/svc/)
    - [k-Nearest Neighbors](http://php-ml.readthedocs.io/en/latest/machine-learning/classification/k-nearest-neighbors/)
    - [Naive Bayes](http://php-ml.readthedocs.io/en/latest/machine-learning/classification/naive-bayes/)
    - Decision Tree (CART)
    - Ensemble Algorithms
        - Bagging (Bootstrap Aggregating)
        - Random Forest
        - AdaBoost
    - Linear
        - Adaline
        - Decision Stump
        - Perceptron
        - LogisticRegression
- Regression
    - [Least Squares](http://php-ml.readthedocs.io/en/latest/machine-learning/regression/least-squares/)
    - [SVR](http://php-ml.readthedocs.io/en/latest/machine-learning/regression/svr/)
- Clustering
    - [k-Means](http://php-ml.readthedocs.io/en/latest/machine-learning/clustering/k-means/)
    - [DBSCAN](http://php-ml.readthedocs.io/en/latest/machine-learning/clustering/dbscan/)
    - Fuzzy C-Means
- Metric
    - [Accuracy](http://php-ml.readthedocs.io/en/latest/machine-learning/metric/accuracy/)
    - [Confusion Matrix](http://php-ml.readthedocs.io/en/latest/machine-learning/metric/confusion-matrix/)
    - [Classification Report](http://php-ml.readthedocs.io/en/latest/machine-learning/metric/classification-report/)
- Workflow
    - [Pipeline](http://php-ml.readthedocs.io/en/latest/machine-learning/workflow/pipeline)
- Neural Network
    - [Multilayer Perceptron Classifier](http://php-ml.readthedocs.io/en/latest/machine-learning/neural-network/multilayer-perceptron-classifier/)
- Cross Validation
    - [Random Split](http://php-ml.readthedocs.io/en/latest/machine-learning/cross-validation/random-split/)
    - [Stratified Random Split](http://php-ml.readthedocs.io/en/latest/machine-learning/cross-validation/stratified-random-split/)
- Preprocessing
    - [Normalization](http://php-ml.readthedocs.io/en/latest/machine-learning/preprocessing/normalization/)
    - [Imputation missing values](http://php-ml.readthedocs.io/en/latest/machine-learning/preprocessing/imputation-missing-values/)
- Feature Extraction
    - [Token Count Vectorizer](http://php-ml.readthedocs.io/en/latest/machine-learning/feature-extraction/token-count-vectorizer/)
    - [Tf-idf Transformer](http://php-ml.readthedocs.io/en/latest/machine-learning/feature-extraction/tf-idf-transformer/)
- Dimensionality Reduction
    - PCA (Principal Component Analysis)
    - Kernel PCA
    - LDA (Linear Discriminant Analysis)
- Datasets
    - [Array](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/array-dataset/)
    - [CSV](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/csv-dataset/)
    - [Files](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/files-dataset/)
    - Ready to use:
        - [Iris](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/demo/iris/)
        - [Wine](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/demo/wine/)
        - [Glass](http://php-ml.readthedocs.io/en/latest/machine-learning/datasets/demo/glass/)
- Models management
    - [Persistency](http://php-ml.readthedocs.io/en/latest/machine-learning/model-manager/persistency/)
- Math
    - [Distance](http://php-ml.readthedocs.io/en/latest/math/distance/)
    - [Matrix](http://php-ml.readthedocs.io/en/latest/math/matrix/)
    - [Set](http://php-ml.readthedocs.io/en/latest/math/set/)
    - [Statistic](http://php-ml.readthedocs.io/en/latest/math/statistic/)
    - Linear Algebra

Contribute
----------

[](#contribute)

- [Issue Tracker: github.com/php-ai/php-ml](https://github.com/php-ai/php-ml/issues)
- [Source Code: github.com/php-ai/php-ml](https://github.com/php-ai/php-ml)

You can find more about contributing in [CONTRIBUTING.md](CONTRIBUTING.md).

License
-------

[](#license)

PHP-ML is released under the MIT Licence. See the bundled LICENSE file for details.

Author
------

[](#author)

Arkadiusz Kondas (@ArkadiuszKondas)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.2% 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 ~55 days

Recently: every ~71 days

Total

10

Last Release

3151d ago

PHP version history (2 changes)v0.1.0PHP &gt;=7.0.0

0.5.0PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18568086?v=4)[ducaicheng](/maintainers/qazdcc)[@qazdcc](https://github.com/qazdcc)

---

Top Contributors

[![akondas](https://avatars.githubusercontent.com/u/8239917?v=4)](https://github.com/akondas "akondas (263 commits)")[![MustafaKarabulut](https://avatars.githubusercontent.com/u/24882371?v=4)](https://github.com/MustafaKarabulut "MustafaKarabulut (14 commits)")[![dmonllao](https://avatars.githubusercontent.com/u/540109?v=4)](https://github.com/dmonllao "dmonllao (12 commits)")[![marmichalski](https://avatars.githubusercontent.com/u/57528542?v=4)](https://github.com/marmichalski "marmichalski (11 commits)")[![alucic](https://avatars.githubusercontent.com/u/1689028?v=4)](https://github.com/alucic "alucic (5 commits)")[![pflorek](https://avatars.githubusercontent.com/u/13916107?v=4)](https://github.com/pflorek "pflorek (4 commits)")[![qazdcc](https://avatars.githubusercontent.com/u/18568086?v=4)](https://github.com/qazdcc "qazdcc (3 commits)")[![y-uti](https://avatars.githubusercontent.com/u/3460059?v=4)](https://github.com/y-uti "y-uti (2 commits)")[![maximecolin](https://avatars.githubusercontent.com/u/606766?v=4)](https://github.com/maximecolin "maximecolin (2 commits)")[![PabloJoan](https://avatars.githubusercontent.com/u/9193314?v=4)](https://github.com/PabloJoan "PabloJoan (2 commits)")[![mvkasatkin](https://avatars.githubusercontent.com/u/3389061?v=4)](https://github.com/mvkasatkin "mvkasatkin (1 commits)")[![povils](https://avatars.githubusercontent.com/u/11535217?v=4)](https://github.com/povils "povils (1 commits)")[![garymarkfuller](https://avatars.githubusercontent.com/u/6162988?v=4)](https://github.com/garymarkfuller "garymarkfuller (1 commits)")[![robertmarsal](https://avatars.githubusercontent.com/u/507871?v=4)](https://github.com/robertmarsal "robertmarsal (1 commits)")[![seahken](https://avatars.githubusercontent.com/u/19169725?v=4)](https://github.com/seahken "seahken (1 commits)")[![bigtallbill](https://avatars.githubusercontent.com/u/727370?v=4)](https://github.com/bigtallbill "bigtallbill (1 commits)")

---

Tags

machine learningartificial intelligenceneural-networkdata sciencefeature extractionpattern recognitioncomputational learning theory

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/qazdcc-php-ml/health.svg)

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

###  Alternatives

[php-ai/php-ml

PHP-ML - Machine Learning library for PHP

1061.9M13](/packages/php-ai-php-ml)[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.5M28](/packages/rubix-ml)[codewithkyrian/transformers

State-of-the-art Machine Learning for PHP. Run Transformers in PHP

758267.3k7](/packages/codewithkyrian-transformers)[denissimon/prediction-builder

A library for machine learning that builds predictions using a linear regression.

1146.7k](/packages/denissimon-prediction-builder)

PHPackages © 2026

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