PHPackages                             medansoftware/c45-algorithm-php - 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. medansoftware/c45-algorithm-php

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

medansoftware/c45-algorithm-php
===============================

1.0.2(4y ago)122928MITPHPPHP &gt;=5.5

Since Nov 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MedanSoftware/C45-Algorithm-PHP)[ Packagist](https://packagist.org/packages/medansoftware/c45-algorithm-php)[ RSS](/packages/medansoftware-c45-algorithm-php/feed)WikiDiscussions master Synced 1w ago

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

C45 Algorithm - PHP Language
============================

[](#c45-algorithm---php-language)

> [**Use Example File**](example.xlsx)

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

[](#installation)

The recommended way to install the C45 PHP library is through [Composer](https://getcomposer.org) :

```
composer require medansoftware/c45-algorithm-php
```

Manual Installation
-------------------

[](#manual-installation)

```
composer dump-autoload
```

Setup
-----

[](#setup)

```
$c45 = new Algorithm\C45('example.xlsx', 'PLAY');
$initialize = $c45->initialize(); // initialize
$buildTree = $initialize->buildTree(); // build tree

$arrayTree = $buildTree->toArray(); // set to array
$stringTree = $buildTree->toString(); // set to string

echo "";
print_r ($arrayTree);
echo "";

echo $stringTree;
```

or

```
$c45 = new Algorithm\C45();
$c45->loadFile('example.xlsx'); // load example file
$c45->setTargetAttribute('PLAY'); // set target attribute

$initialize = $c45->initialize(); // initialize
$buildTree = $initialize->buildTree(); // build tree

$arrayTree = $buildTree->toArray(); // set to array
$stringTree = $buildTree->toString(); // set to string

echo "";
print_r ($arrayTree);
echo "";

echo $stringTree;
```

Other Examples
--------------

[](#other-examples)

```
$c45 = new Algorithm\C45();
$c45->loadFile('example.xlsx')->setTargetAttribute('PLAY')->initialize();

echo "";
print_r ($c45->buildTree()->toString()); // print as string
echo "";

echo "";
print_r ($c45->buildTree()->toJson()); // print as JSON
echo "";

echo "";
print_r ($c45->buildTree()->toArray()); // print as array
echo "";
```

Initialize Data from Array
--------------------------

[](#initialize-data-from-array)

```
$c45 = new Algorithm\C45();
$input = new Algorithm\C45\DataInput;
$data = array(
	array(
		"OUTLOOK" => "Sunny",
		"TEMPERATURE" => "Hot",
		"HUMIDITY" => "High",
		"WINDY" => "False",
		"PLAY" => "No"
	),
	array(
		"OUTLOOK" => "Sunny",
		"TEMPERATURE" => "Hot",
		"HUMIDITY" => "High",
		"WINDY" => "True",
		"PLAY" => "No"
	),
	array(
		"OUTLOOK" => "Cloudy",
		"TEMPERATURE" => "Hot",
		"HUMIDITY" => "High",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Rainy",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "High",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Rainy",
		"TEMPERATURE" => "Cool",
		"HUMIDITY" => "Normal",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Rainy",
		"TEMPERATURE" => "Cool",
		"HUMIDITY" => "Normal",
		"WINDY" => "True",
		"PLAY" => "No"
	),
	array(
		"OUTLOOK" => "Cloudy",
		"TEMPERATURE" => "Cool",
		"HUMIDITY" => "Normal",
		"WINDY" => "True",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Sunny",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "High",
		"WINDY" => "False",
		"PLAY" => "No"
	),
	array(
		"OUTLOOK" => "Sunny",
		"TEMPERATURE" => "Cool",
		"HUMIDITY" => "Normal",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Rainy",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "Normal",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Sunny",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "Normal",
		"WINDY" => "True",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Cloudy",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "High",
		"WINDY" => "True",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Cloudy",
		"TEMPERATURE" => "Hot",
		"HUMIDITY" => "Normal",
		"WINDY" => "False",
		"PLAY" => "Yes"
	),
	array(
		"OUTLOOK" => "Rainy",
		"TEMPERATURE" => "Mild",
		"HUMIDITY" => "High",
		"WINDY" => "True",
		"PLAY" => "No"
	)
);

// Initialize Data
$input->setData($data); // Set data from array
$input->setAttributes(array('OUTLOOK', 'TEMPERATURE', 'HUMIDITY', 'WINDY', 'PLAY')); // Set attributes of data

// Initialize C4.5
$c45->c45 = $input; // Set input data
$c45->setTargetAttribute('PLAY'); // Set target attribute
$initialize = $c45->initialize(); // initialize

// Build Output
$buildTree = $initialize->buildTree(); // Build tree
$arrayTree = $buildTree->toArray(); // Set to array
$stringTree = $buildTree->toString(); // Set to string

echo "";
print_r ($arrayTree);
echo "";

echo $stringTree;
```

```
$new_data = array(
	'OUTLOOK' => 'Sunny',
	'TEMPERATURE' => 'Hot',
	'HUMIDITY' => 'High',
	'WINDY' => FALSE
);

echo $c45->initialize()->buildTree()->classify($new_data); // print "No"
```

[Refrence](https://github.com/juliardi/C45)

**Made with ❤️ + ☕ ~ Agung Dirgantara**

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

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

Total

3

Last Release

1485d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24e8e95a612ecb77482b7ba9f36439d1edcb2509205a84cc0f71b53fad2eeaca?d=identicon)[agoenks29D](/maintainers/agoenks29D)

---

Top Contributors

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

---

Tags

c45-treesdataminingdecision-tree

### Embed Badge

![Health badge](/badges/medansoftware-c45-algorithm-php/health.svg)

```
[![Health](https://phpackages.com/badges/medansoftware-c45-algorithm-php/health.svg)](https://phpackages.com/packages/medansoftware-c45-algorithm-php)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

44763.4k2](/packages/pimcore-data-importer)[portphp/spreadsheet

PhpSpreadsheet reader and writer for Port

14796.4k4](/packages/portphp-spreadsheet)

PHPackages © 2026

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