PHPackages                             ernilambar/classifier - 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. ernilambar/classifier

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

ernilambar/classifier
=====================

A PHP library for classifying and grouping data based on JSON configuration rules with schema validation support.

1.0.0(9mo ago)02MITPHPPHP &gt;=7.4CI passing

Since Aug 17Pushed 8mo agoCompare

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

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

Classifier
==========

[](#classifier)

A PHP library for classifying and grouping data based on JSON configuration rules with schema validation support.

Features
--------

[](#features)

- **Flexible Classification**: Group data based on prefix or contains matching rules
- **JSON Schema Validation**: Validate configuration files against JSON schemas

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

[](#installation)

```
composer require ernilambar/classifier
```

Usage
-----

[](#usage)

### Workflow

[](#workflow)

The classifier follows this simple workflow:

1. Plugin provides JSON file path (via constructor)
2. Validate JSON content with schema
3. If failed, do not proceed
4. If pass, then group based on that JSON file config

```
use Nilambar\Classifier\Classifier;

// Define JSON file path.
$json_file_path = '/path/to/groups.json';

// Initialize classifier with JSON file path.
$classifier = new Classifier($json_file_path);

// Sample data to classify.
$data = [
    [
        'code'    => 'trademark_wordpress',
        'type'    => 'error',
        'message' => 'WordPress trademark violation',
    ],
    [
        'code'    => 'WordPress.Security.NonceVerification',
        'type'    => 'warning',
        'message' => 'Nonce verification missing',
    ],
];

// Execute the workflow
$result = $classifier->classify($data);

if (empty($result)) {
    echo "Validation failed. Process stopped.";
} else {
    // Process the classified data
    foreach ($result as $group_id => $items) {
        echo "Group: {$group_id}\n";
        foreach ($items as $item) {
            echo "  - {$item['code']}: {$item['message']}\n";
        }
    }
}
```

Configuration Format
--------------------

[](#configuration-format)

The classifier uses a JSON configuration file to define grouping rules:

```
{
  "$schema": "./groups-schema.json",
  "trademark": {
    "id": "trademark",
    "title": "Trademarks",
    "children": {
      "trademark_prefix": {
        "id": "trademark_prefix",
        "title": "Trademarks Prefix",
        "type": "prefix",
        "parent": "trademark",
        "checks": ["trademark_"]
      }
    }
  }
}
```

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Composer
- `justinrainbow/json-schema` for schema validation

License
-------

[](#license)

MIT License

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance58

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

274d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2098823?v=4)[Nilambar Sharma](/maintainers/ernilambar)[@ernilambar](https://github.com/ernilambar)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ernilambar-classifier/health.svg)

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

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[getdkan/dkan

DKAN Open Data Catalog

385135.4k2](/packages/getdkan-dkan)[e0ipso/shaper

Lightweight library to handle in and out transformations in PHP.

157.8M4](/packages/e0ipso-shaper)[nfephp-org/sped-esocial

e-Social library

18030.7k](/packages/nfephp-org-sped-esocial)[optimizely/optimizely-sdk

Optimizely PHP SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts

191.8M1](/packages/optimizely-optimizely-sdk)

PHPackages © 2026

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