PHPackages                             lattice/ahp - 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. lattice/ahp

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

lattice/ahp
===========

Analytic Hierarchy Process implementation in PHP

05PHP

Since May 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rrossier/rr-ahp)[ Packagist](https://packagist.org/packages/lattice/ahp)[ RSS](/packages/lattice-ahp/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Analytic hierarchy process
==========================

[](#analytic-hierarchy-process)

PHP implementation of the Analytic Hierarchy Process (AHP) by [Thomas L. Saaty](https://en.wikipedia.org/wiki/Thomas_L._Saaty).

Description
-----------

[](#description)

More on [Wikipedia](https://en.wikipedia.org/wiki/Analytic_hierarchy_process)

Installation via Composer
-------------------------

[](#installation-via-composer)

```
composer require lattice/ahp

```

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

Reproducting the `Choose a Leader` example from [Wikipedia](https://en.wikipedia.org/wiki/Analytic_hierarchy_process_%E2%80%93_leader_example)

```
$ahp = new AHP();

$tom = new Candidate(['name'=>'Tom','profile'=>['experience'=>10,'education'=>5,'charisma'=>9,'age'=>50]]);
$dick = new Candidate(['name'=>'Dick','profile'=>['experience'=>30,'education'=>3,'charisma'=>5,'age'=>60]]);
$harry = new Candidate(['name'=>'Harry','profile'=>['experience'=>5,'education'=>7,'charisma'=>3,'age'=>30]]);

$experienceCriterion = new Criterion('Experience');
$educationCriterion = new Criterion('Education');
$charismaCriterion = new Criterion('Charisma');
$ageCriterion = new Criterion('Age');

$ahp->addCandidate($tom);
$ahp->addCandidate($dick);
$ahp->addCandidate($harry);

$ahp->displayResults('total');
$ahp->displayResults();
```

More in the following files:

- [examples.php](examples.php) explaining basic examples
- [examples2.php](examples2.php) showing the full example of [Choosing a car for the Jones family](https://en.wikipedia.org/wiki/Analytic_hierarchy_process_%E2%80%93_car_example)
- [examples3.php](examples3.php) documenting the class **Matrix**

Todo
----

[](#todo)

- implements a load function to define model in a file
- implements custom preference functions

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](https://opensource.org/licenses/MIT) file for details

Acknowledgments
---------------

[](#acknowledgments)

- Inspiration for formatting results and ideas for future evolutions thanks to [R package AHP](https://cran.r-project.org/web/packages/ahp/)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/49bd61d09b46ccf36043f7a0eae2cc0a28b844308745110699c52cecca734e47?d=identicon)[rrossier](/maintainers/rrossier)

---

Top Contributors

[![rrossier](https://avatars.githubusercontent.com/u/51224106?v=4)](https://github.com/rrossier "rrossier (1 commits)")

### Embed Badge

![Health badge](/badges/lattice-ahp/health.svg)

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

###  Alternatives

[ideea/language-detector

Detect languages by text

334.4k](/packages/ideea-language-detector)

PHPackages © 2026

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