PHPackages                             michael34435/php-ranker - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. michael34435/php-ranker

ActiveLibrary[Testing &amp; Quality](/categories/testing)

michael34435/php-ranker
=======================

Grab GPA from your project with phpcs/phpmd/phpcpd violation report

1.0.3(9y ago)3106.1k↓40.9%1MITPHP

Since Jan 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/michael34435/php-ranker)[ Packagist](https://packagist.org/packages/michael34435/php-ranker)[ RSS](/packages/michael34435-php-ranker/feed)WikiDiscussions master Synced 1mo ago

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

php-ranker
==========

[](#php-ranker)

[![Build Status](https://camo.githubusercontent.com/a5e0d0caed83d59038a4514ad5e361d7f51954cb1e21fdba4fa6ec2e84b2a1e7/68747470733a2f2f7472617669732d63692e6f72672f6d69636861656c33343433352f7068702d72616e6b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/michael34435/php-ranker)[![Code Climate](https://camo.githubusercontent.com/1670767cde2ef3e2c4353b92b010061328da6b6e590683ae3379f3697629c94d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d69636861656c33343433352f7068702d72616e6b65722f6261646765732f6770612e737667)](https://codeclimate.com/github/michael34435/php-ranker)

What's php-ranker?
------------------

[](#whats-php-ranker)

`php-ranker` is a command line based parser to parse `xml` format report file generated by `phpmd`, `phpcs` and `phpcpd`.
All scores calculated by `php-ranker` are based on `codeclimate` except duplication report from `phpcpd`, because `codeclimate` use their own analysis tool(`flay`) to identify the code block is identical or similar but `phpcpd` cannot do it.

What metric do php-ranker use?
------------------------------

[](#what-metric-do-php-ranker-use)

There are three dimensions `php-ranker` taken.

- Checkstyle
    - All the things include `PSR-2` standard and more
- PMD
    - Checkstyle, complexity and code size
- Dry
    - Duplication code detected from `phpcpd` instead of `flay`

How grades are calculated?
--------------------------

[](#how-grades-are-calculated)

### What's GPA(Grade Point Average)?

[](#whats-gpagrade-point-average)

All grades are following GPA(Grade Point Average) a concept to determine you is good or bad in average in U.S school, most of it are 4-point-rule.

### How to calculate it?

[](#how-to-calculate-it)

In general, GPA is **four-point**, it means the greatest student gets 4-point while the worst gets 0-point in this subject.
And we'll end up getting an average score from a person.
Like this chart:

GradePointA4.0B3.0C2.0D1.0F0.0For example, there is a student who gets two A's(represents 4-point) and one B(represents 3-point) and we will get a formula -&gt; *(2 x 4 + 3) / (2 + 1) = 3.67*
`3.67` is the final score for this student.

### How php-ranker get file score

[](#how-php-ranker-get-file-score)

You have to add a config file named `.php-ranker`(see `.php-ranker.example`) in your project and composer require `php-ranker`.
Then `php-ranker` will read your config file and glob them to compare violation report from `phpcs`, `phpmd` or `phpcpd`.
Finally, `php-ranker` gives each file a point below.(all rules are following `codeclimate`)

PointsRank0-2MA&gt;2M-4MB&gt;4M-8MC&gt;8M-16MD&gt;16MFSo your file will get a total point and `php-ranker` converts it to alphabetic rank finally.

### How php-ranker get total GPA

[](#how-php-ranker-get-total-gpa)

All GPAs are based on file size.
For example, `php-ranker` finds three files

FilenameRankLinesFoo.phpA100FooBar.phpA200Bar.phpF1000`Foo.php` A rank represent 4 point
`FooBar.php` A rank represent 4 point, too
But `Bar.php` is too bad to get score and get 0 point.

And we can find a formula -&gt; *(4 x 100 + 4 x 200 + 0 x 1000) / (200 + 100 + 1000) = 0.93*

`0.93` is the total GPA score for these files.

How to use php-ranker
---------------------

[](#how-to-use-php-ranker)

### Install

[](#install)

#### Composer

[](#composer)

```
composer require michael34435/php-ranker
```

#### Phar

[](#phar)

```
curl -LOk https://github.com/michael34435/php-ranker/raw/master/build/php-ranker
chmod +x php-ranker
mv php-ranker /usr/bin/php-ranker
```

### Usage

[](#usage)

```
./vendor/bin/php-ranker
```

- `--pmd-report` - `phpmd` violation report path(xml)
- `--dry-report` - `phpcpd` violation report path(xml)
- `--checkstyle-report` - `phpcs` violation report(xml)
- `--export-dir` - The path you want to store for the GPA report html

### Notice

[](#notice)

Version `0.01` and `0.02` only support jenkins report, i would like to recommend you to upgrade to `1.0.0` or `dev-master` ASAP.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

5

Last Release

3409d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c38cefe9dce3f1f79281d191c182769a38256474da748ca2a5d5371eef59f7e?d=identicon)[michael34435](/maintainers/michael34435)

---

Top Contributors

[![michael34435](https://avatars.githubusercontent.com/u/3980983?v=4)](https://github.com/michael34435 "michael34435 (71 commits)")

---

Tags

checkstylecode-qualityduplicationgradespmdscoreviolation-report

### Embed Badge

![Health badge](/badges/michael34435-php-ranker/health.svg)

```
[![Health](https://phpackages.com/badges/michael34435-php-ranker/health.svg)](https://phpackages.com/packages/michael34435-php-ranker)
```

###  Alternatives

[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[axelerant/drupal-quality-checker

Code quality checking tools for Drupal project.

13197.9k1](/packages/axelerant-drupal-quality-checker)[blackboard-open-source/moodle-plugin-ci

Assists with running Moodle plugins in Travis CI

42141.8k](/packages/blackboard-open-source-moodle-plugin-ci)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)

PHPackages © 2026

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