PHPackages                             torian257x/ai-php-rubix-wrap - 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. torian257x/ai-php-rubix-wrap

ActiveLibrary

torian257x/ai-php-rubix-wrap
============================

AI PHP is a wrapper for rubix ml

0.9.1.1(4y ago)1710341MITPHPPHP &gt;=8.0

Since Jul 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/torian257x/ai-php-rubix-wrap)[ Packagist](https://packagist.org/packages/torian257x/ai-php-rubix-wrap)[ RSS](/packages/torian257x-ai-php-rubix-wrap/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (4)Used By (1)

AI PHP Rubix Wrap
=================

[](#ai-php-rubix-wrap)

A wrapper for [Rubix ML](https://github.com/RubixML/ML) to make it very approachable

Example:

```
    $report = RubixService::train($data, 'column_with_label');
```

Where `column_with_label` is the key of the multi dimensional array `$data` that contains the value that you want to predict.

Let's make a simple example:

```
$apartment_data = [
        ['space_m2' =>  10, 'price' => 100],
        ['space_m2' =>  20, 'price' => 200],
        ['space_m2' =>  30, 'price' => 300],
        ['space_m2' =>  40, 'price' => 400],
        //...
        ['space_m2' => 280, 'price' => 2800],
        ['space_m2' => 290, 'price' => 2900],
        ['space_m2' => 300, 'price' => 3000],
];

$report = RubixService::train($apartment_data, 'price');

var_export($report);

/*
  array (
    'mean absolute error' => 68.88888888888889,
    ...
    'r squared' => 0.9796739130434783,
    ...
  )
*/

$prediction = RubixService::predict(['space_m2' => 250]);
//$prediciton ~2440

```

[See full example of above code here](https://github.com/torian257x/ai-php-rubix-wrap/blob/master/tests/Unit/ReadmeExamplesTest.php)

Reports / Errors / Accuracy
---------------------------

[](#reports--errors--accuracy)

Mean absolute error is basically the actual error you can expect in average. So *in average* if trying to predict an apartment given the space, you'd be off, in average, by 68.88$

`r squared` on the other hand gives more of a feeling how good the algorithm is in %. A high r squared means it works well. For categorical features like `cat` or `dog` a [different report is returned](https://docs.rubixml.com/latest/cross-validation.html#classification-and-anomaly-detection)

Estimators / Machine Learning Algorithm
---------------------------------------

[](#estimators--machine-learning-algorithm)

`RubixService::train()` will use a default estimator (machine learning algorithm) depending on the data. If you want to choose a different estimator I recommend reading here

[rubix ml choosing an estimator](https://docs.rubixml.com/latest/choosing-an-estimator.html)

Notice: Neural network is called **Multilayer Perceptron** in Rubix. Linear regression is called **Ridge**.

Per default it uses [K-d Neighbors](https://docs.rubixml.com/latest/classifiers/kd-neighbors.html) or [K-d Neighbors Regressor](https://docs.rubixml.com/latest/regressors/kd-neighbors-regressor.html)

`RubixService::train()` takes as well [transformers](https://docs.rubixml.com/latest/preprocessing.html)

In detail `RubixService:train()` does

1. shuffle of `$data`
2. train against 70% of `$data`
3. test against 30% of `$data`

You can change that behaviour by using the argument `train_part_size` e.g. if you want to train on 80%, and test on 20% you would do `RubixService::train(... train_part_size: 0.8)`.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

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

Total

3

Last Release

1734d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f81e0df7bc60738ed970122e1a5cf30bda81af5b651eaa8b25fc1dee653e3c5b?d=identicon)[Torian257x](/maintainers/Torian257x)

---

Top Contributors

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

---

Tags

phpaimlRubix

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/torian257x-ai-php-rubix-wrap/health.svg)

```
[![Health](https://phpackages.com/badges/torian257x-ai-php-rubix-wrap/health.svg)](https://phpackages.com/packages/torian257x-ai-php-rubix-wrap)
```

###  Alternatives

[rubix/ml

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

2.2k1.4M28](/packages/rubix-ml)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[thehocinesaad/laravel-error-ai

This package adds Ask AI button to the error page.

2214.4k](/packages/thehocinesaad-laravel-error-ai)

PHPackages © 2026

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