PHPackages                             camspiers/silverstripe-classifierbridge - 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. camspiers/silverstripe-classifierbridge

ActiveSilverstripe-module

camspiers/silverstripe-classifierbridge
=======================================

0.1.1(11y ago)31.3k1[3 PRs](https://github.com/camspiers/silverstripe-classifierbridge/pulls)MITPHP

Since Dec 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/camspiers/silverstripe-classifierbridge)[ Packagist](https://packagist.org/packages/camspiers/silverstripe-classifierbridge)[ RSS](/packages/camspiers-silverstripe-classifierbridge/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

SilverStripe Classifier Bridge
==============================

[](#silverstripe-classifier-bridge)

This library helps integrate classification services within SilverStripe sites.

Installation (with composer)
----------------------------

[](#installation-with-composer)

```
$ composer require camspiers/silverstripe-classifierbridge:dev-master

```

Usage
-----

[](#usage)

### Integration via DataList and DataObject

[](#integration-via-datalist-and-dataobject)

1. Implement the Document interface on your DataObject

```
use Camspiers\StatisticalClassifier\SilverStripe\Document;

class MyDataObject extends DataObject implements Document
{

	private static $db = array(
		'Content' => 'Text'
		'Spam' => 'Boolean'
	);

	public function getCategories()
	{
		return array($this->Spam ? 'spam' : 'ham');
	}

	public function getDocument()
	{
		return $this->Content;
	}

}
```

2. Use a DataList to retrieve the existing DataObjects and classify a new DataObject

```
use Camspiers\StatisticalClassifier\Classifier\ComplementNaiveBayes;
use Camspiers\StatisticalClassifier\SilverStripe\DataSource;
use Camspiers\StatisticalClassifier\SilverStripe\Document;

// This DataObject could have been just populate via a form (e.g. $form->saveInto($myDataObject))
$dataObjectToClassify = new MyDataObject(
	array(
		'Content' => 'Some content'
	)
);

try {
	// A DataList is passed into a DataSource and then passed into the classifier
	$classifier = new ComplementNaiveBayes(new DataSource(MyDataObject::get()));
	if ($classifier->is('spam', $dataObjectToClassify->getDocument())) {
		// The document is spam
		// Perhaps set Spam = true on the DataObject and save it
	} else {
		// The document isn't spam
	}
} catch (Exception $e) {
	// Do something with the exception
}
```

### Integration via SQLQuery

[](#integration-via-sqlquery)

Using SQLQuery can improve memory usage and execution time, because it bypasses the creation of DataObjects for each record

```
use Camspiers\StatisticalClassifier\Classifier\ComplementNaiveBayes;
use Camspiers\StatisticalClassifier\DataSource\Grouped;
use Camspiers\StatisticalClassifier\SilverStripe\SQLQueryDataSource;
use Camspiers\StatisticalClassifier\SilverStripe\Document;

$spamQuery = new SQLQuery("Content, Spam", "MyDataObject", "Spam = 1");
$hamQuery = new SQLQuery("Content, Spam", "MyDataObject", "Spam = 0");

try {
	// Create the classifier by using a Grouped data source
	$classifier = new ComplementNaiveBayes(
		new Grouped(
			array(
				new SQLQueryDataSource("spam", $spamQuery, "Content"),
				new SQLQueryDataSource("ham", $hamQuery, "Content")
			)
		)
	);

	if ($classifier->is('spam', "Some content to classify")) {
		// The document is spam
		// Perhaps set Spam = true on the DataObject and save it
	} else {
		// The document isn't spam
	}
} catch (Exception $e) {
	// Do something with the exception
}
```

See [PHP Classifier](https://github.com/camspiers/statistical-classifier) for documentation around caching and more advanced topics.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

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

Total

2

Last Release

4309d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91d02ba78b01d0432821f6195f11d6b95aa8da31f02f8aaea7a2e7215662061a?d=identicon)[camspiers](/maintainers/camspiers)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/camspiers-silverstripe-classifierbridge/health.svg)

```
[![Health](https://phpackages.com/badges/camspiers-silverstripe-classifierbridge/health.svg)](https://phpackages.com/packages/camspiers-silverstripe-classifierbridge)
```

PHPackages © 2026

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